tools_intellij_platform_gradle_plugin.md: cleanup, fixes, incorporate relevant changes from #1357 (@Jonatha1983)

This commit is contained in:
Yann Cébron 2024-10-02 15:20:14 +02:00
parent 3fea8195e9
commit c520ab695b

View File

@ -110,21 +110,19 @@ pluginManagement {
>
> To update all dependencies in the dependency cache, use the `--refresh-dependencies` command line option.
### Plugins
The IntelliJ Platform Gradle Plugin consists of [plugins](tools_intellij_platform_gradle_plugin_plugins.md) which can be applied depending on the purpose.
By default, the [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugin (`org.jetbrains.intellij.platform`) should be applied to the main plugin project module.
When working with the [](#multi-module-project-structure) it is required to use [](tools_intellij_platform_gradle_plugin_plugins.md#module) plugin (`org.jetbrains.intellij.platform.module`) instead to creating tasks and configurations specific to the main module only.
When working in a [](#multi-module-project-structure) it is required to use [](tools_intellij_platform_gradle_plugin_plugins.md#module) plugin (`org.jetbrains.intellij.platform.module`) instead of creating tasks and configurations specific to the main module only.
The [](tools_intellij_platform_gradle_plugin_plugins.md#settings) plugin (`org.jetbrains.intellij.platform.settings`) allows for adding plugin development related repositories right in the <path>settings.gradle.kts</path> file if project configuration involves [](#configuration.dependencyResolutionManagement).
### Attaching Sources
To attach IntelliJ Platform sources in the IDE, the <control>Download sources</control> setting has to be enabled in IDE versions 2023.2 and later.
This option respects the [](tools_intellij_platform_gradle_plugin_gradle_properties.md#downloadSources) property, which is enabled by default.
This option respects the plugin's [](tools_intellij_platform_gradle_plugin_gradle_properties.md#downloadSources) property, which is enabled by default.
<tabs>
@ -150,9 +148,9 @@ No additional IDE settings are required.
</tabs>
The attaching sources is handed by the Plugin DevKit plugin thus it's recommended to use always the latest available IDE release.
The attaching sources operation in the IDE is handled by the _Plugin DevKit_ plugin, thus it is recommended to always use the latest available IDE version.
If the opened compiled class has no sources available locally, the Plugin DevKit plugin will detect the relevant source coordinates and provide an action to <control>Download IntelliJ Platform sources</control> or <control>Attach \$API_NAME\$ sources</control>.
If the opened compiled class has no sources available locally, the _Plugin DevKit_ plugin will detect the relevant source coordinates and provide an action to <control>Download IntelliJ Platform sources</control> or <control>Attach \$API_NAME\$ sources</control>.
## Configuration
@ -161,6 +159,7 @@ If the opened compiled class has no sources available locally, the Plugin DevKit
{title="Exploring Configuration Options"}
### Setting Up Repositories
{#configuration.repositories}
All IntelliJ Platform SDK artifacts are available via IntelliJ Maven repositories (see [](intellij_artifacts.md)), which exist in three variants:
@ -210,13 +209,16 @@ repositories {
See [](tools_intellij_platform_gradle_plugin_repositories_extension.md) on how to configure additional repositories.
#### Dependency Resolution Management
{#configuration.dependencyResolutionManagement}
To access the IntelliJ Platform Gradle Plugin within the <path>settings.gradle.kts</path> to use with `dependencyResolutionManagement`, add:
To access the IntelliJ Platform Gradle Plugin within the Gradle Settings file to use with `dependencyResolutionManagement`, add:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
<path>settings.gradle.kts</path>
```kotlin
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
@ -238,8 +240,11 @@ dependencyResolutionManagement {
```
</tab>
<tab title="Groovy" group-key="groovy">
<path>settings.gradle</path>
```groovy
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
@ -263,7 +268,6 @@ dependencyResolutionManagement {
</tab>
</tabs>
#### Cache Redirector
{#configuration.cacheRedirector}
@ -274,7 +278,7 @@ To switch off the default usage of JetBrains Cache Redirector, see the [](tools_
### Setting Up IntelliJ Platform
Dependencies and [repositories](#configuration.repositories) are handled using explicit entries within `dependencies {}` and `repositories {}` blocks in <path>build.gradle.kts</path> file.
Dependencies and [repositories](#configuration.repositories) are handled using explicit entries within `dependencies {}` and `repositories {}` blocks in the Gradle build file.
A minimum configuration for targeting IntelliJ IDEA Community 2023.3:
@ -335,6 +339,7 @@ See [](tools_intellij_platform_gradle_plugin_dependencies_extension.md) on how t
{style="note"}
#### Parametrize IntelliJ Platform Dependency
{#dependenciesParametrizePlatform}
As a fallback, `intellijPlatform` extension can be used to allow dynamic configuration of the target platform, for example, via <path>gradle.properties</path>:
@ -344,7 +349,7 @@ platformType = IC
platformVersion = 2023.3
```
The above Gradle properties can be referenced in the <path>build.gradle.kts</path> file with:
The above Gradle properties can be referenced in the Gradle build file with:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
@ -413,8 +418,8 @@ dependencies {
</tab>
</tabs>
#### Local IntelliJ Platform IDE Instance
{#dependenciesLocalPlatform}
It is possible to refer to the locally available IntelliJ-based IDE using the `local` helper function:
@ -511,12 +516,11 @@ dependencies {
<include from="tools_intellij_platform_gradle_plugin_repositories_extension.md" element-id="localPlatformArtifacts_required"/>
### Multi-Module Project Structure
When working on a complex plugin, it is often convenient to split the code base into multiple submodules.
To avoid polluting submodules with tasks or configurations specific to the root module only (e.g., tasks for signing, publishing, or running the plugin),
a dedicated subplugin was introduced.
To avoid polluting submodules with tasks or configurations specific to the root module only (for example, tasks for signing, publishing, or running the plugin),
a dedicated sub-plugin was introduced.
The root module of the IntelliJ-based plugin project must apply the main [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugin as follows: