[IntelliJ Platform Gradle Plugin] Groovy code samples

This commit is contained in:
Jakub Chrzanowski 2024-08-16 20:40:58 +02:00
parent c36cab2564
commit 56c48db043
No known key found for this signature in database
GPG Key ID: C39095BFD769862E
12 changed files with 1470 additions and 10 deletions

View File

@ -46,18 +46,36 @@ IntelliJ Platform Gradle Plugin 2.x requires the following minimal versions:
To apply the IntelliJ Platform Gradle Plugin to a project, add the following entry to the `plugins` block in the <path>build.gradle.kts</path> file:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
plugins {
id("org.jetbrains.intellij.platform") version "%intellij-platform-gradle-plugin-version%"
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
plugins {
id 'org.jetbrains.intellij.platform' version '%intellij-platform-gradle-plugin-version%'
}
```
</tab>
</tabs>
If migrating from the [](tools_gradle_intellij_plugin.md), replace the old `org.jetbrains.intellij` identifier to `org.jetbrains.intellij.platform` and apply its latest `%intellij-platform-gradle-plugin-version%` version.
### Snapshot Release
To use the latest snapshot versions, add the following to the <path>settings.gradle.kts</path> file:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
pluginManagement {
repositories {
@ -67,6 +85,24 @@ pluginManagement {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
pluginManagement {
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
gradlePluginPortal()
}
}
```
</tab>
</tabs>
[//]: # (> The current IntelliJ Platform Gradle Plugin Snapshot version is ![GitHub Snapshot Release]&#40;https://img.shields.io/nexus/s/org.jetbrains.intellij.platform/intellij-platform-gradle-plugin?server=https://oss.sonatype.org&label=&#41;)
> The current IntelliJ Platform Gradle Plugin Snapshot version is: `2.0.0-SNAPSHOT`
>
@ -139,6 +175,9 @@ All IntelliJ Platform SDK artifacts are available via IntelliJ Maven repositorie
Build a plugin against a release version of the IntelliJ Platform with dependency on a plugin from the JetBrains Marketplace:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -150,6 +189,24 @@ repositories {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
releases()
marketplace()
}
}
```
</tab>
</tabs>
See [](tools_intellij_platform_gradle_plugin_repositories_extension.md) on how to configure additional repositories.
#### Dependency Resolution Management
@ -157,6 +214,9 @@ See [](tools_intellij_platform_gradle_plugin_repositories_extension.md) on how t
To access the IntelliJ Platform Gradle Plugin within the <path>settings.gradle.kts</path> to use with `dependencyResolutionManagement`, add:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
@ -177,6 +237,33 @@ dependencyResolutionManagement {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
plugins {
id 'org.jetbrains.intellij.platform.settings' version '%intellij-platform-gradle-plugin-version%'
}
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
}
```
</tab>
</tabs>
#### Cache Redirector
{#configuration.cacheRedirector}
@ -191,6 +278,9 @@ Dependencies and [repositories](#configuration.repositories) are handled using e
A minimum configuration for targeting IntelliJ IDEA Community 2023.3:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -207,6 +297,29 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity('2023.3')
}
}
```
</tab>
</tabs>
The `intellijIdeaCommunity` in the previous sample is one of the extension functions available for adding IntelliJ Platform dependencies to the project.
See [](tools_intellij_platform_gradle_plugin_dependencies_extension.md) on how to target other IDEs.
@ -233,6 +346,9 @@ platformVersion = 2023.3
The above Gradle properties can be referenced in the <path>build.gradle.kts</path> file with:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
dependencies {
intellijPlatform {
@ -244,8 +360,29 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
dependencies {
intellijPlatform {
def type = providers.gradleProperty('platformType')
def version = providers.gradleProperty('platformVersion')
create(type, version)
}
}
```
</tab>
</tabs>
The `intellijPlatform` helper accepts also the [`IntelliJPlatformType`](tools_intellij_platform_gradle_plugin_types.md#IntelliJPlatformType) type:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
@ -258,11 +395,33 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
dependencies {
intellijPlatform {
def version = providers.gradleProperty('platformVersion')
create(IntelliJPlatformType.IntellijIdeaUltimate, version)
}
}
```
</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:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
intellijPlatform {
@ -277,6 +436,27 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
local '/Users/user/Applications/IntelliJ IDEA Ultimate.app'
}
}
```
</tab>
</tabs>
<include from="tools_intellij_platform_gradle_plugin_repositories_extension.md" element-id="localPlatformArtifacts_required"/>
### Setting Up Plugin Dependencies
@ -285,6 +465,9 @@ To specify a dependency on a plugin, it is important to distinguish bundled plug
The [](tools_intellij_platform_gradle_plugin_dependencies_extension.md) provides a set of helpers to manage [plugin dependencies](tools_intellij_platform_gradle_plugin_dependencies_extension.md#plugins):
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
intellijPlatform {
@ -302,6 +485,30 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
bundledPlugin 'com.intellij.java'
plugin 'org.intellij.scala', '2024.1.4'
}
}
```
</tab>
</tabs>
<include from="tools_intellij_platform_gradle_plugin_repositories_extension.md" element-id="localPlatformArtifacts_required"/>
@ -313,18 +520,50 @@ a dedicated subplugin 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:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
plugins {
id("org.jetbrains.intellij.platform") version "%intellij-platform-gradle-plugin-version%"
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
plugins {
id 'org.jetbrains.intellij.platform' version '%intellij-platform-gradle-plugin-version%'
}
```
</tab>
</tabs>
Any other included submodule must use the [](tools_intellij_platform_gradle_plugin_plugins.md#module) plugin instead:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
plugins {
id("org.jetbrains.intellij.platform.module")
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
plugins {
id 'org.jetbrains.intellij.platform.module'
}
```
</tab>
</tabs>
<include from="snippets.md" element-id="missingContent"/>

View File

@ -25,7 +25,12 @@ It also includes methods for adding [plugins](#plugins) (including bundled), [Je
- add JUnit4 test dependency
- add Test Framework for testing plugin with JUnit4
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
repositories {
mavenCentral()
@ -52,6 +57,42 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
bundledPlugin 'com.intellij.java'
pluginVerifier()
zipSigner()
instrumentationTools()
testFramework TestFrameworkType.Platform.INSTANCE
}
testImplementation 'junit:junit:4.13.2'
// other dependencies, e.g., 3rd-party libraries
}
```
</tab>
</tabs>
## Target Platforms
> Only one IntelliJ Platform dependency can be added to the project at a time.
@ -111,6 +152,9 @@ When declaring a dependency on IntelliJ Platform, the IDE installer is resolved
The IntelliJ Platform installer is the IDE final distribution used by end-users for installing and running IDE in their machines.
Those artifacts are resolved from JetBrains Download CDN (download.jetbrains.com) or Android Studio CDN.
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
intellijPlatform {
@ -120,11 +164,32 @@ repositories {
dependencies {
intellijPlatform {
IntellijIdeaCommunity("2024.1.4")
IntellijIdeaCommunity("%ijPlatform%")
}
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
IntellijIdeaCommunity '%ijPlatform%'
}
}
```
</tab>
</tabs>
The listing of all present installers can be resolved with updates XML files for [JetBrains IDEs](https://www.jetbrains.com/updates/updates.xml) and [Android Studio](https://jb.gg/android-studio-releases-list.xml) as well as by executing the [`printProductsReleases`](tools_intellij_platform_gradle_plugin_tasks.md#printProductsReleases) task.
IntelliJ Platform installers are OS-specific and contain bundled [](tools_intellij_platform_gradle_plugin_jetbrains_runtime.md), but are limited to public releases only.
@ -140,6 +205,9 @@ It is still possible to use Multi-OS ZIP archives resolved from [](tools_intelli
To enable resolving this kind of artifacts, opt-out from the installer dependencies by adding `useInstaller = false` argument to helpers described in [](#target-platforms), like:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
intellijPlatform {
@ -150,12 +218,35 @@ repositories {
dependencies {
intellijPlatform {
IntellijIdeaCommunity("%ijPlatform%", useInstaller = false)
intellijIdeaCommunity("%ijPlatform%", useInstaller = false)
jetbrainsRuntime()
}
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity "%ijPlatform%", false
jetbrainsRuntime()
}
}
```
</tab>
</tabs>
The Multi-OS Archives don't bundle [](tools_intellij_platform_gradle_plugin_jetbrains_runtime.md) needed to run the IDE locally, perform testing, and other crucial operations.
Therefore, it is required to explicitly add a dependency on JetBrains Runtime (JBR) by adding extra `jetbrainsRuntime()` repository and dependency entries.
@ -212,6 +303,9 @@ Use `localPlugin(localPath)` to add a dependency on a local IntelliJ Platform pl
To implement [tests](testing_plugins.md) for IntelliJ Platform plugin, it is necessary to explicitly add a dependency on the `test-framework` library containing the necessary test base classes.
In most cases, the `TestFrameworkType.Platform` variant will be used:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
@ -224,6 +318,24 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
dependencies {
intellijPlatform {
testFramework TestFrameworkType.Platform.INSTANCE
}
testImplementation 'junit:junit:4.13.2'
}
```
</tab>
</tabs>
The provided `testFramework(type, version)` helper method makes it possible to add the base artifact to the test classpath or its variants, such as Java, Go, ReSharper, etc.
| Function | Description |

View File

@ -17,6 +17,9 @@ After the IntelliJ Platform Gradle Plugin is [applied](tools_intellij_platform_g
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
buildSearchableOptions = true
@ -39,6 +42,35 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
buildSearchableOptions = true
instrumentCode = true
projectName = project.name
sandboxContainer = '...'
pluginConfiguration {
// ...
}
publishing {
// ...
}
signing {
// ...
}
pluginVerification {
// ...
}
}
```
</tab>
</tabs>
### `cachePath`
{#intellijPlatform-cachePath}
@ -229,6 +261,9 @@ Requires the [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugi
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -256,6 +291,40 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
pluginConfiguration {
id = 'my-plugin-id'
name = 'My Awesome Plugin'
version = '1.0.0'
description = 'It\'s an awesome plugin!'
changeNotes =
"""
A descriptive release note...
""".stripIndent()
productDescriptor {
// ...
}
ideaVersion {
// ...
}
vendor {
// ...
}
}
}
```
</tab>
</tabs>
See also:
- [](#intellijPlatform-pluginConfiguration-productDescriptor)
- [](#intellijPlatform-pluginConfiguration-ideaVersion)
@ -358,6 +427,9 @@ A part of the [](#intellijPlatform-pluginConfiguration) which describes the `pro
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -376,6 +448,31 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
pluginConfiguration {
// ...
productDescriptor {
code = 'MY_CODE'
releaseDate = '20240217'
releaseVersion = '20241'
optional = false
eap = false
}
}
}
```
</tab>
</tabs>
See also:
- [How to add required parameters for paid plugins](https://plugins.jetbrains.com/docs/marketplace/add-required-parameters.html)
@ -474,6 +571,9 @@ A part of the [](#intellijPlatform-pluginConfiguration) which describes the [`<i
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -489,6 +589,28 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
pluginConfiguration {
// ...
ideaVersion {
sinceBuild = '241'
untilBuild = '241.*'
}
}
}
```
</tab>
</tabs>
See also:
- [](build_number_ranges.md)
@ -545,6 +667,9 @@ A part of the [](#intellijPlatform-pluginConfiguration) which describes the [`<v
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -561,6 +686,29 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
pluginConfiguration {
// ...
vendor {
name = 'JetBrains'
email = 'hello@jetbrains.com'
url = 'https://www.jetbrains.com'
}
}
}
```
</tab>
</tabs>
### `name`
{#intellijPlatform-pluginConfiguration-vendor-name}
@ -616,6 +764,9 @@ Requires the [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugi
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -630,6 +781,27 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
publishing {
host = ''
token = '7hR4nD0mT0k3n_8f2eG'
channels = ['default']
ideServices = false
hidden = false
}
}
```
</tab>
</tabs>
### `host`
{#intellijPlatform-publishing-host}
@ -721,6 +893,9 @@ Requires the [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugi
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
// ...
@ -741,6 +916,33 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
// ...
signing {
cliPath = file('/path/to/marketplace-zip-signer-cli.jar')
keyStore = file('/path/to/keyStore.ks')
keyStorePassword = '...'
keyStoreKeyAlias = '...'
keyStoreType = '...'
keyStoreProviderName = '...'
privateKey = '...'
privateKeyFile = file('/path/to/private.pem')
password = '...'
certificateChain = '...'
certificateChainFile = file('/path/to/chain.crt')
}
}
```
</tab>
</tabs>
See also:
- [](plugin_signing.md)
- [Tasks: `signPlugin`](tools_intellij_platform_gradle_plugin_tasks.md#signPlugin)
@ -916,7 +1118,12 @@ Requires the [](tools_intellij_platform_gradle_plugin_plugins.md#platform) plugi
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
intellijPlatform {
// ...
@ -940,6 +1147,39 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
intellijPlatform {
// ...
pluginVerification {
cliPath = file('/path/to/plugin-verifier-cli.jar')
freeArgs = ['foo', 'bar']
homeDirectory = file('/path/to/pluginVerifierHomeDirectory/')
downloadDirectory = file('/path/to/pluginVerifierHomeDirectory/ides/')
failureLevel = VerifyPluginTask.FailureLevel.ALL
verificationReportsDirectory = 'build/reports/pluginVerifier'
verificationReportsFormats = VerifyPluginTask.VerificationReportsFormats.ALL
externalPrefixes = 'com.example'
teamCityOutputFormat = false
subsystemsToCheck = VerifyPluginTask.Subsystems.ALL
ignoredProblemsFile = file('/path/to/ignoredProblems.txt')
ides {
// ...
}
}
}
```
</tab>
</tabs>
See also:
- [](verifying_plugin_compatibility.md)
- [Tasks: `verifyPlugin`](tools_intellij_platform_gradle_plugin_tasks.md#verifyPlugin)
@ -1123,8 +1363,12 @@ It provides a set of helpers which add relevant entries to the configuration, wh
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
intellijPlatform {
// ...
@ -1133,7 +1377,6 @@ intellijPlatform {
// ...
ides {
ide(IntelliJPlatformType.PhpStorm)
ide(IntelliJPlatformType.RustRover, "2023.3")
local(file("/path/to/ide/"))
recommended()
@ -1148,6 +1391,38 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
intellijPlatform {
// ...
pluginVerification {
// ...
ides {
ide IntelliJPlatformType.RustRover, "2023.3"
local file('/path/to/ide/')
recommended()
select {
types = [IntelliJPlatformType.PhpStorm]
channels = [ProductRelease.Channel.RELEASE]
sinceBuild = '232'
untilBuild = '241.*'
}
}
}
}
```
</tab>
</tabs>
See also:
- [](verifying_plugin_compatibility.md)
- [Tasks: `verifyPlugin`](tools_intellij_platform_gradle_plugin_tasks.md#verifyPlugin)

View File

@ -8,6 +8,9 @@
Using the [very same task documentation](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html), configure [`runIde`](tools_intellij_platform_gradle_plugin_tasks.md#runIde) task:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
tasks {
runIde {
@ -18,6 +21,24 @@ tasks {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
tasks {
runIde {
jvmArgumentProviders.add({
["-Dname=value"]
} as CommandLineArgumentProvider)
}
}
```
</tab>
</tabs>
### Task `runIdeForUiTests` not found
The [`runIdeForUiTests`](tools_intellij_platform_gradle_plugin_tasks.md#runIdeForUiTests) is no longer registered by default.
@ -35,6 +56,9 @@ java.lang.NoClassDefFoundError: org/opentest4j/AssertionFailedError
To apply the workaround, add the missing `org.opentest4j:opentest4j` test dependency to your Gradle build configuration:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
dependencies {
// ...
@ -42,6 +66,20 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
dependencies {
// ...
testImplementation 'org.opentest4j:opentest4j:1.3.0'
}
```
</tab>
</tabs>
### JUnit5 Test Framework refers to JUnit4
Due to the [IJPL-159134](https://youtrack.jetbrains.com/issue/IJPL-159134/JUnit5-Test-Framework-refers-to-JUnit4-java.lang.NoClassDefFoundError-junit-framework-TestCase) issue, the JUnit5 Test Framework refers to JUnit4 classes when running test.
@ -56,6 +94,9 @@ Caused by: java.lang.NoClassDefFoundError: org/junit/rules/TestRule
To apply the workaround, add the JUnit4 test runtime dependency to your Gradle build configuration:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
dependencies {
// ...
@ -63,6 +104,20 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
dependencies {
// ...
testRuntimeOnly 'junit:junit:4.13.2'
}
```
</tab>
</tabs>
### Dependency on bundled plugin is not resolved after migrating from 1.x
{id="migrateToPluginId"}
@ -81,14 +136,33 @@ See [](ide_development_instance.md#enabling-auto-reload) for important caveats.
You can disable auto-reload globally with [`intellijPlatform.autoReload`](tools_intellij_platform_gradle_plugin_extension.md#intellijPlatform-autoReload):
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
autoReload = false
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
autoReload = false
}
```
</tab>
</tabs>
It is also possible to disable it for a specific [`runIde`](tools_intellij_platform_gradle_plugin_tasks.md#runIde)-based task as follows:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
tasks {
runIde {
@ -97,16 +171,47 @@ tasks {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
tasks {
runIde {
autoReload = false
}
}
```
</tab>
</tabs>
### How to disable building the searchable options?
Building the searchable options can be disabled using [`intellijPlatform.buildSearchableOptions`](tools_intellij_platform_gradle_plugin_extension.md#intellijPlatform-instrumentCode):
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
buildSearchableOptions = false
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
buildSearchableOptions = false
}
```
</tab>
</tabs>
As a result of disabling building searchable options, the [Settings](settings.md) that your plugin provides won't be searchable in the <ui-path>Settings</ui-path> dialog.
Disabling of the task is suggested for plugins that are not intended to provide custom settings.
@ -141,6 +246,9 @@ To mute specific problems (for example, use of specific forbidden words in the p
See the list of [available options](https://github.com/JetBrains/intellij-plugin-verifier/?tab=readme-ov-file#specific-options).
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatform {
pluginVerification {
@ -153,6 +261,25 @@ intellijPlatform {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatform {
pluginVerification {
// ...
freeArgs = [
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix",
]
}
}
```
</tab>
</tabs>
### JaCoCo Reports 0% Coverage
The Gradle IntelliJ Plugin, when targeting the IntelliJ SDK `2022.1+`, uses the `PathClassLoader` class loader by the following system property:
@ -220,7 +347,13 @@ Please upgrade to Kotlin 1.9.0. See the [](using_kotlin.md#incremental-compilati
To list the IntelliJ Platform releases matching your criteria (IntelliJ Platform type, release channels, or build range), you may use the [](tools_intellij_platform_gradle_plugin_tasks.md#printProductsReleases) task, as follows:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
tasks {
printProductsReleases {
channels = listOf(ProductRelease.Channel.EAP)
@ -234,6 +367,30 @@ tasks {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
tasks {
printProductsReleases {
channels = [ProductRelease.Channel.EAP]
types = [IntelliJPlatformType.IntellijIdeaCommunity]
untilBuild = null
doLast {
def latestEap = productsReleases.get().max()
}
}
}
```
</tab>
</tabs>
### The currently selected Java Runtime is not JetBrains Runtime (JBR)
When running tests or IDE with your plugin loaded, it is necessary to use JetBrains Runtime (JBR).
@ -249,6 +406,9 @@ or define it explicitly with project dependencies or JVM Toolchain.
To correctly run your tests or a specific IDE:
- use a binary IDE distribution with bundled JetBrains Runtime, i.e., by referring to a local IDE [`local(localPath)`](tools_intellij_platform_gradle_plugin_dependencies_extension.md#custom-target-platforms)
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -265,7 +425,32 @@ To correctly run your tests or a specific IDE:
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
local '/Users/hsz/Applications/IntelliJ IDEA Ultimate.app'
}
}
```
</tab>
</tabs>
- add an explicit dependency on a JetBrains Runtime with [`jetbrainsRuntime()`](tools_intellij_platform_gradle_plugin_dependencies_extension.md#java-runtime)
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -283,7 +468,35 @@ To correctly run your tests or a specific IDE:
}
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
jetbrainsRuntime '...'
}
}
```
</tab>
</tabs>
- specify the vendor when configuring the JVM Toolchain along with [Foojay Toolchains Plugin](https://github.com/gradle/foojay-toolchains):
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
kotlin {
jvmToolchain {
@ -293,4 +506,20 @@ To correctly run your tests or a specific IDE:
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}
```
</tab>
</tabs>
<include from="snippets.md" element-id="missingContent"/>

View File

@ -27,6 +27,9 @@ In such a case, it is necessary to provide it in the suitable version with the v
This can be easily achieved by using the `jetbrainsRuntime()` repository helper pointing to [JetBrains Runtime GitHub Releases](https://github.com/JetBrains/JetBrainsRuntime/releases/) and dependency helper with no arguments provided:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -48,10 +51,41 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
// ...
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
jetbrainsRuntime()
// ...
}
}
```
</tab>
</tabs>
## Declared Explicitly
It is possible to explicitly specify JetBrains Runtime version, variant, or exact build with:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -75,6 +109,36 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
// ...
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
jetbrainsRuntime(version, variant, architecture)
// or
jetbrainsRuntimeExplicit(explicitVersion)
// ...
}
}
```
</tab>
</tabs>
Provided `version`, `variant`, and `architecture` parameters along with the `explicitVersion` are used to resolve the JetBrains Runtime archives published on [GitHub Releases](https://github.com/JetBrains/JetBrainsRuntime/releases/) page.
To correctly understand the pattern, refer to the archive names in format:
@ -108,6 +172,9 @@ Since Gradle `8.4`, it is possible to specify JetBrains as a known JVM vendor an
Along with the [Foojay Toolchains Plugin](https://github.com/gradle/foojay-toolchains), Gradle can resolve JetBrains Runtime from the remote repository if the suitable JVM is not present:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
<path>build.gradle.kts</path>
```kotlin
kotlin {
@ -121,10 +188,34 @@ kotlin {
<path>settings.gradle.kts</path>
```kotlin
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "..."
id("org.gradle.toolchains.foojay-resolver-convention") version "..."
}
```
</tab>
<tab title="Groovy" group-key="groovy">
<path>build.gradle</path>
```groovy
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}
```
<path>settings.gradle</path>
```groovy
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '...'
}
```
</tab>
</tabs>
Please note that the latest available JetBrains Runtime release is always resolved, which may lead to unexpected behaviors.
## Project SDK

View File

@ -172,6 +172,9 @@ The `runIdeForUiTests` task is obsolete and should be replaced with an explicit
The task running IDE with the Robot Server Plugin should be declared now as a custom `runIde` task with plugin loaded:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
@ -191,6 +194,32 @@ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
jvmArgumentProviders.add({
[
'-Drobot-server.port=8082',
'-Dide.mac.message.dialogs.as.sheets=false',
'-Djb.privacy.policy.text=<!--999.999-->',
'-Djb.consents.confirmation.enabled=false',
]
} as CommandLineArgumentProvider)
}
plugins {
robotServerPlugin()
}
}
```
</tab>
</tabs>
### `runPluginVerifier`
The task for running the IntelliJ Plugin Verifier is now called [`verifyPlugin`](tools_intellij_platform_gradle_plugin_tasks.md#verifyPlugin).
@ -229,8 +258,23 @@ Alternatively, edit the <path>.idea/workspace.xml</path> file and remove the `se
Add an explicit dependency on [the plugin](https://github.com/JetBrains/gradle-idea-ext-plugin) in <path>build.gradle.kts</path>:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
plugins {
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.8"
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
plugins {
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
}
```
</tab>
</tabs>

View File

@ -55,6 +55,9 @@ flowchart TB
This is a top-level plugin that applies all the tooling for plugin development for IntelliJ-based IDEs.
It should be used only with the root module (for submodules, see [](#module)).
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
<path>build.gradle.kts</path>
```kotlin
plugins {
@ -62,6 +65,19 @@ plugins {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
<path>build.gradle.kts</path>
```kotlin
plugins {
id("org.jetbrains.intellij.platform") version "%intellij-platform-gradle-plugin-version%"
}
```
</tab>
</tabs>
### Available tasks
{#platform-available-tasks}
@ -102,6 +118,10 @@ This plugin applies a smaller set of functionalities for compiling and testing s
Compared to the main plugin, it doesn't contain tasks related to publishing or running the IDE for testing purposes.
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
<path>settings.gradle.kts</path>
```kotlin
@ -155,6 +175,66 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
<path>settings.gradle</path>
```groovy
rootProject.name = '...'
include ':submodule'
```
<path>submodule/build.gradle</path>
```groovy
plugins {
id 'org.jetbrains.intellij.platform.module'
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
}
}
```
<path>build.gradle</path>
```groovy
plugins {
id 'org.jetbrains.intellij.platform' version '%intellij-platform-gradle-plugin-version%'
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
pluginModule(implementation(project(':submodule')))
}
}
```
</tab>
</tabs>
Note that the `:submodule` is added both to the `implementation` configuration and `intellijPlatformPluginModule` using the [](tools_intellij_platform_gradle_plugin_dependencies_extension.md#plugins) helper method.
This guarantees that the submodule content will be merged into the main plugin JAR file.
@ -186,6 +266,9 @@ If you define project repositories within the <path>settings.gradle.kts</path> u
This approach allows for omitting the `repositories {}` definition in the <path>build.gradle.kts</path> files. See [](tools_intellij_platform_gradle_plugin.md#configuration.dependencyResolutionManagement) for more details.
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
<path>settings.gradle.kts</path>
```kotlin
@ -247,6 +330,73 @@ dependencies {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
<path>settings.gradle</path>
```groovy
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
plugins {
id 'org.jetbrains.intellij.platform.settings' version '%intellij-platform-gradle-plugin-version%'
}
rootProject.name = '...'
dependencyResolutionManagement {
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
}
include ':submodule'
```
<path>build.gradle</path>
```groovy
plugins {
id 'org.jetbrains.intellij.platform'
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
pluginModule(implementation(project(':submodule')))
}
}
```
> Note that <path>build.gradle</path> doesn't define the IntelliJ Platform Gradle Plugin version anymore as it was earlier declared in the <path>settings.gradle</path> file.
> Specifying the version in two places may result in the following Gradle exception:
>
> `The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.`
<path>submodule/build.gradle</path>
```groovy
plugins {
id 'org.jetbrains.intellij.platform.module'
}
dependencies {
intellijPlatform {
intellijIdeaCommunity '%ijPlatform%'
}
}
```
</tab>
</tabs>
## Migration
{#migration}
@ -274,6 +424,9 @@ Prepares all the custom configurations, transformers, and base tasks needed to m
It also introduces the [](tools_intellij_platform_gradle_plugin_extension.md) to the <path>build.gradle.kts</path> file along with [](tools_intellij_platform_gradle_plugin_dependencies_extension.md) and [](tools_intellij_platform_gradle_plugin_repositories_extension.md) to help preconfigure project dependencies:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
...
@ -293,6 +446,32 @@ dependencies {
intellijPlatform { ... }
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
...
// Repositories Extension
intellijPlatform { ... }
}
dependencies {
...
// Dependencies Extension
intellijPlatform { ... }
}
// IntelliJ Platform Extension
intellijPlatform { ... }
```
</tab>
</tabs>
The plugin also introduces a task listener which allows for creating custom tasks decorated with [](tools_intellij_platform_gradle_plugin_task_awares.md).
See [](tools_intellij_platform_gradle_plugin_recipes.md) for more details.

View File

@ -8,6 +8,9 @@
To create a custom task with the sandbox directory specified outside of the default <path>build/idea-sandbox/[TYPE]-[VERSION]/</path> location, pass the new location to its `prepareSandboxTask` sandbox producer configuration:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
// ...
@ -19,6 +22,26 @@ val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting.runIde {
runWithCustomSandbox {
// ...
prepareSandboxTask {
sandboxDirectory = project.layout.buildDirectory.dir('custom-sandbox')
sandboxSuffix = ''
}
}
}
```
</tab>
</tabs>
This will result in the following sandbox structure:
```
@ -35,7 +58,12 @@ build/
With [](tools_intellij_platform_gradle_plugin_task_awares.md) it is possible to enhance any Gradle task with features provided with the IntelliJ Platform Gradle Plugin.
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.tasks.aware.IntelliJPlatformVersionAware
abstract class MyTask : DefaultTask(), IntelliJPlatformVersionAware
val myTask by tasks.registering(MyTask::class) {
@ -46,6 +74,26 @@ val myTask by tasks.registering(MyTask::class) {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.tasks.aware.IntelliJPlatformVersionAware
abstract class MyTask extends DefaultTask implements IntelliJPlatformVersionAware {}
tasks.register('myTask', MyTask) {
doLast {
println("platformPath = \n${platformPath}")
println("productInfo.buildNumber = ${productInfo.buildNumber}")
}
}
```
</tab>
</tabs>
As soon as the registered task inherits from the `*Aware` interface, such as [`IntelliJPlatformVersionAware`](tools_intellij_platform_gradle_plugin_task_awares.md#IntelliJPlatformVersionAware), all the related information will be injected during the configuration phase.
@ -53,6 +101,9 @@ As soon as the registered task inherits from the `*Aware` interface, such as [`I
Additional files can be bundled by adding them to the plugin directory when preparing the sandbox:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
tasks {
prepareSandbox {
@ -63,8 +114,25 @@ tasks {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
tasks.named('prepareSandbox', PrepareSandboxTask) {
from layout.projectDirectory.dir('extraFiles')
into it.pluginName.map { "$it/extra" }
}
```
</tab>
</tabs>
To apply that to the custom task, use the [`prepareSandboxTask`](tools_intellij_platform_gradle_plugin_testing_extension.md#preparesandboxtask) reference:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
// ...
@ -77,8 +145,31 @@ val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting.runIde {
runWithCustomSandbox {
// ...
prepareSandboxTask {
from(...)
into(...)
}
}
}
```
</tab>
</tabs>
It is possible to apply that to all [`PrepareSandboxTask`](tools_intellij_platform_gradle_plugin_tasks.md#prepareSandbox) with:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
tasks {
withType<PrepareSandboxTask> {
@ -88,3 +179,18 @@ tasks {
}
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
tasks {
withType(PrepareSandboxTask) {
from(...)
into(...)
}
}
```
</tab>
</tabs>

View File

@ -29,6 +29,9 @@ It provides methods to add:
Setup Maven Central and [`defaultRepositories()`](tools_intellij_platform_gradle_plugin_repositories_extension.md#default-repositories) repositories:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
mavenCentral()
@ -39,6 +42,23 @@ repositories {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
```
</tab>
</tabs>
</snippet>
## Default Repositories
@ -104,6 +124,9 @@ In such a case, refer to them using [`plugin(id, version, group)`](tools_intelli
The third possibility is to use the [](custom_plugin_repository.md) with optional authorization credentials provided by defining the URL to the XML listing file, like:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
repositories {
intellijPlatform {
@ -117,6 +140,26 @@ repositories {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
repositories {
intellijPlatform {
customPluginRepository('https://example.com/plugins.xml', CustomPluginRepositoryListingType.SIMPLE) {
credentials(HttpHeaderCredentials) {
name = 'Authorization'
value = 'Automation amFrdWJfdGVzdDotX...MkV2UkFwekFWTnNwZjA='
}
}
}
}
```
</tab>
</tabs>
The final plugin archive is eventually resolved using the same credentials used for resolving the listing.

View File

@ -11,7 +11,12 @@ The Task Awares is a set of interfaces that can be applied to custom Gradle task
IntelliJ Platform Gradle Plugin supports creating custom tasks which can use `*Aware` interfaces.
Example:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
import org.jetbrains.intellij.platform.gradle.tasks.aware.PluginAware
abstract class RetrievePluginNameTask : DefaultTask(), PluginAware
val retrievePluginName by tasks.registering(RetrievePluginNameTask::class) {
@ -23,6 +28,25 @@ val retrievePluginName by tasks.registering(RetrievePluginNameTask::class) {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
import org.jetbrains.intellij.platform.gradle.tasks.aware.PluginAware
abstract class RetrievePluginNameTask extends DefaultTask implements PluginAware {}
tasks.register('retrievePluginName', RetrievePluginNameTask) {
def outputFile = layout.buildDirectory.file("pluginName.txt")
doLast {
outputFile.get().asFile.writeText(pluginXml.parse { name }.get())
}
}
```
</tab>
</tabs>
## `AutoReloadAware`
@ -328,6 +352,9 @@ The `parse` method provides a possibility for parsing the <path>pluginXml</path>
Should be used along with the [`pluginXml`](#PluginAware-pluginXml) property like:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
abstract class RetrievePluginNameTask : DefaultTask(), PluginAware
@ -339,6 +366,22 @@ val retrievePluginName by tasks.registering(RetrievePluginNameTask::class) {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
abstract class RetrievePluginNameTask extends DefaultTask implements PluginAware {}
tasks.register('retrievePluginName', RetrievePluginNameTask) {
doLast {
def name = pluginXml.parse { name }.get()
println("Plugin Name: $name")
}
}
```
</tab>
</tabs>
## `PluginVerifierAware`

View File

@ -1217,6 +1217,9 @@ Runs the IDE instance using the currently selected IntelliJ Platform with the bu
This task is not available by default and needs to be registered manually by applying the following code:
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
@ -1235,6 +1238,32 @@ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting.runIde {
runIdeForUiTests {
task {
jvmArgumentProviders.add({
[
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
]
} as CommandLineArgumentProvider)
}
plugins {
robotServerPlugin()
}
}
}
```
</tab>
</tabs>
## `setupDependencies`
{#setupDependencies}

View File

@ -11,8 +11,8 @@ It provides a possibility for registering custom tasks for running the IDE, unit
For each of the custom tasks, a dedicated sandbox is created to isolate them form other tasks or the build flow as they may rely on a different IntelliJ Platform version, plugins, or other configuration.
## IntelliJ Platform Testing
{#intellijPlatformTesting}
After the IntelliJ Platform Gradle Plugin is [applied](tools_intellij_platform_gradle_plugin.md#usage), the `intellijPlatformTesting` extension can be used for registering new tasks to fulfil specific requirements of the project.
@ -22,6 +22,9 @@ Registering of a custom task which allows for adjusting the IntelliJ Platform ty
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
intellijPlatformTesting {
runIde
@ -31,11 +34,30 @@ intellijPlatformTesting {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting {
runIde
testIde
testIdeUi
testIdePerformance
}
```
</tab>
</tabs>
By default, created tasks depend on the IntelliJ Platform defined with [](tools_intellij_platform_gradle_plugin_dependencies_extension.md).
However, it is possible to adjust it to any requirements with passing custom values directly to the created object, `task`, or `sandboxTask` task instances.
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
val runPhpStorm by intellijPlatformTesting.runIde.registering {
type = IntelliJPlatformType.PhpStorm
@ -62,6 +84,39 @@ val runPhpStorm by intellijPlatformTesting.runIde.registering {
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting.runIde {
runPhpStorm {
type = IntelliJPlatformType.PhpStorm
version = ...
useInstaller = ...
localPath = ...
sandboxDirectory = ...
splitMode = ...
splitModeTarget = ...
task {
...
}
prepareSandboxTask {
...
}
plugins {
...
}
}
}
```
</tab>
</tabs>
### `task {}`
@ -74,13 +129,11 @@ Depending on the type of registered object, a different `task` class is availabl
| `testIdeUi` | [`TestIdeUiTask`](tools_intellij_platform_gradle_plugin_tasks.md#testIdeUi) |
| `testIdePerformance` | [`TestIdePerformanceTask`](tools_intellij_platform_gradle_plugin_tasks.md#testIdePerformance) |
### `prepareSandboxTask {}`
The `prepareSandboxTask` refers to a dedicated [`PrepareSandboxTask`](tools_intellij_platform_gradle_plugin_tasks.md#prepareSandbox) task instance, connected only with a newly created task.
The name of this task is based on the name of created task, like `prepareSandbox_[TASK_NAME]`.
### `plugins {}`
An extension to provide custom plugins to be added when running the task runtime, or disabling bundled ones.
@ -89,9 +142,25 @@ It provides several methods for adding remote and local plugins, or for disablin
**Example:**
<tabs group="languages">
<tab title="Kotlin" group-key="kotlin">
```kotlin
tasks {
val runIdeWithPlugins by intellijPlatformTesting.runIde.registering {
// ...
plugins {
plugin("pluginId", "1.0.0")
disablePlugin("pluginId")
}
}
```
</tab>
<tab title="Groovy" group-key="groovy">
```groovy
intellijPlatformTesting.runIde {
runIdeWithPlugins {
// ...
plugins {
plugin("pluginId", "1.0.0")
@ -101,6 +170,9 @@ tasks {
}
```
</tab>
</tabs>
| Function | Description |
|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `plugin(id, version, channel)` | Adds a dependency on a plugin for a custom IntelliJ Platform. |
@ -111,6 +183,4 @@ tasks {
| `localPlugin(path)` | Adds a dependency on a local IntelliJ Platform plugin. Accepts path or a dependency on another module. |
| `robotServerPlugin(version)` | Adds a dependency on a Robot Server Plugin. |
<include from="snippets.md" element-id="missingContent"/>