diff --git a/topics/basics/plugin_signing.md b/topics/basics/plugin_signing.md index cc711ef2c..8864d8ca2 100644 --- a/topics/basics/plugin_signing.md +++ b/topics/basics/plugin_signing.md @@ -81,7 +81,7 @@ An example `pluginSigning` configuration may look like: -```Groovy +```groovy signPlugin { certificateChain = """ -----BEGIN CERTIFICATE----- @@ -110,7 +110,7 @@ publishPlugin { -```Kotlin +```kotlin signPlugin { certificateChain.set(""" -----BEGIN CERTIFICATE----- @@ -155,7 +155,7 @@ To specify secrets like `PUBLISH_TOKEN` and values required for the `signPlugin` -```Groovy +```groovy signPlugin { certificateChain = System.getenv("CERTIFICATE_CHAIN") privateKey = System.getenv("PRIVATE_KEY") @@ -170,7 +170,7 @@ publishPlugin { -```Kotlin +```kotlin signPlugin { certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) privateKey.set(System.getenv("PRIVATE_KEY")) diff --git a/topics/products/androidstudio/android_studio.md b/topics/products/androidstudio/android_studio.md index 121c0533f..242eb6123 100644 --- a/topics/products/androidstudio/android_studio.md +++ b/topics/products/androidstudio/android_studio.md @@ -56,22 +56,48 @@ Here are the steps to configure the build.gradle file for developin The snippet below is an example of configuring the Setup and Running DSLs in a build.gradle specific to developing a plugin targeted at Android Studio. -```groovy - intellij { - // Define IntelliJ Platform against which to build the plugin project. - version = '191.8026.42' // Same IntelliJ IDEA version (2019.1.4) as target 3.5 Android Studio - type = 'IC' // Use IntelliJ IDEA CE because it's the basis of the IntelliJ Platform - // Require the Android plugin, Gradle will match the plugin version to intellij.version - plugins = ['android'] - } + + - runIde { - // Absolute path to installed target 3.5 Android Studio to use as IDE Development Instance - // The "Contents" directory is macOS specific. - ideDir = file('/Applications/Android Studio.app/Contents') - } +```groovy +intellij { + // Define IntelliJ Platform against which to build the plugin project. + version = '191.8026.42' // Same IntelliJ IDEA version (2019.1.4) as target 3.5 Android Studio + type = 'IC' // Use IntelliJ IDEA CE because it's the basis of the IntelliJ Platform + // Require the Android plugin, Gradle will match the plugin version to intellij.version + plugins = ['android'] +} + +runIde { + // Absolute path to installed target 3.5 Android Studio to use as IDE Development Instance + // The "Contents" directory is macOS specific. + ideDir = file('/Applications/Android Studio.app/Contents') +} ``` + + + +```kotlin +intellij { + // Define IntelliJ Platform against which to build the plugin project. + version.set("191.8026.42") // Same IntelliJ IDEA version (2019.1.4) as target 3.5 Android Studio + type.set("IC") // Use IntelliJ IDEA CE because it's the basis of the IntelliJ Platform + // Require the Android plugin, Gradle will match the plugin version to intellij.version + plugins.set(listOf("android")) +} + +runIde { + // Absolute path to installed target 3.5 Android Studio to use as IDE Development Instance + // The "Contents" directory is macOS specific. + ideDir.set(file("/Applications/Android Studio.app/Contents")) +} +``` + + + + + ### Configuring the Plugin plugin.xml File When using APIs from the `android` plugin, declare a dependency: diff --git a/topics/products/dev_alternate_products.md b/topics/products/dev_alternate_products.md index ddeef6427..228bcf32d 100644 --- a/topics/products/dev_alternate_products.md +++ b/topics/products/dev_alternate_products.md @@ -43,6 +43,9 @@ A build.gradle snippet setting a plugin project to target PyCharm i The `gradle-intellij-plugin` will fetch the matching build of PyCharm Professional to define the APIs available, and use that build of PyCharm (and associated JetBrains runtime) as the Development Instance. No additional product-specific configuration needs to be set in build.gradle: + + + ```groovy intellij { version = '2019.2.3' @@ -50,6 +53,19 @@ intellij { } ``` + + + +```kotlin +intellij { + version.set("2019.2.3") + type.set("PY") +} +``` + + + + ### Configuring Plugin Projects Using the IntelliJ IDEA Product Attribute If the `gradle-intellij-plugin` does not directly support an IntelliJ Platform-based product, the build.gradle file can still be configured to target the desired product. In this case, the build.gradle file is configured to use IntelliJ IDEA (Community or Ultimate Edition) as the basis for the available APIs. @@ -106,6 +122,9 @@ The exact path format varies by operating system. This snippet is an example for configuring the Setup and Running DSLs in a build.gradle specific to developing a plugin for _targetIDE_. + + + ```groovy intellij { // Define the IntelliJ Platform against which to build the plugin project. @@ -124,6 +143,30 @@ runIde { } ``` + + + +```kotlin +intellij { + // Define the IntelliJ Platform against which to build the plugin project. + // Use the IntelliJ Platform BRANCH.BUILD version matching "targetIDE" (PhpStorm) + version.set("192.7142.36") // baseIntelliJPlatformVersion + type.set("IU") + // Require the targetIDE plugin or library + // Use the stable version compatible with intellij.version and intellij.type specified above + plugins.set(listOf("com.jetbrains.php:192.6603.42")) +} + +runIde { + // Absolute path to the installed targetIDE to use as IDE Development Instance + // Note the Contents directory must be added at the end of the path for macOS. + ideDir.set(file("/Users/$USERNAME$/Library/Application Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/192.7142.41/PhpStorm.app/Contents")) +} +``` + + + + ## Configuring plugin.xml As discussed on the [Plugin Dependencies](plugin_compatibility.md#declaring-plugin-dependencies) page of this guide, a plugin's dependency on [Modules Specific to Functionality](plugin_compatibility.md#modules-specific-to-functionality) must be declared in plugin.xml. When using features (APIs) specific to the target product, a dependency on the target product module must be declared, as shown in the code snippet below. diff --git a/topics/reference_guide/intellij_artifacts.md b/topics/reference_guide/intellij_artifacts.md index 5146315da..68e4b6087 100644 --- a/topics/reference_guide/intellij_artifacts.md +++ b/topics/reference_guide/intellij_artifacts.md @@ -97,6 +97,9 @@ There are two parts to the example: the repository and the dependency sections. This code snippet selects the release repository with the first URL, and the repository of IntelliJ Platform dependencies with the second URL. The second URL is needed because this example selects individual modules. + + + ```groovy repositories { maven { url "https://www.jetbrains.com/intellij-repository/releases" } @@ -104,16 +107,45 @@ repositories { } ``` + + + +```kotlin +repositories { + maven("https://www.jetbrains.com/intellij-repository/releases") + maven("https://cache-redirector.jetbrains.com/intellij-dependencies") +} +``` + + + + ### Dependencies Section This code snippet specifies the desired module artifacts. + + + ```groovy dependencies { - compile "com.jetbrains.intellij.platform:jps-model-serialization:182.2949.4" - compile "com.jetbrains.intellij.platform:jps-model-impl:182.2949.4" + implementation "com.jetbrains.intellij.platform:jps-model-serialization:182.2949.4" + implementation "com.jetbrains.intellij.platform:jps-model-impl:182.2949.4" } ``` + + + +```kotlin +dependencies { + implementation("com.jetbrains.intellij.platform:jps-model-serialization:182.2949.4") + implementation("com.jetbrains.intellij.platform:jps-model-impl:182.2949.4") +} +``` + + + + Note: * The artifact version (`182.2949.4`) must match in both statements. * In this example `jps-model-serialization` declares the APIs and `jps-model-impl` provides the implementation, so both are required dependencies. diff --git a/topics/tutorials/build_system/deployment.md b/topics/tutorials/build_system/deployment.md index 51b572a3a..4cc220b82 100644 --- a/topics/tutorials/build_system/deployment.md +++ b/topics/tutorials/build_system/deployment.md @@ -49,12 +49,28 @@ export ORG_GRADLE_PROJECT_intellijPublishToken='YOUR_TOKEN' Now provide the environment variable in the run configuration with which you run the `publishPlugin` task locally. To do so, create a Gradle run configuration (if not already done), choose your Gradle project, specify the `publishPlugin` task, and then add the environment variable. + + + ```groovy publishPlugin { token = System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken") } ``` + + + +```kotlin +publishPlugin { + token.set(System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken")) +} +``` + + + + + Note that you still need to put some default values (can be empty) in the Gradle properties because otherwise, you will get a compilation error. ### Using Parameters for the Gradle Task @@ -91,12 +107,27 @@ If successfully deployed, any users who currently have your plugin installed on You may also deploy plugins to a release channel of your choosing, by configuring the `publishPlugin.channels` property. For example: + + + ```groovy publishPlugin { channels = ['beta'] } ``` + + + +```kotlin +publishPlugin { + channels.set(listOf("beta")) +} +``` + + + + When empty, this uses the default plugin repository, available to all [JetBrains Marketplace](https://plugins.jetbrains.com/) users. However, you can publish it to an arbitrarily-named channel. These non-default release channels are treated as separate repositories. diff --git a/topics/tutorials/build_system/gradle_prerequisites.md b/topics/tutorials/build_system/gradle_prerequisites.md index e577f11b5..a01b74bc9 100644 --- a/topics/tutorials/build_system/gradle_prerequisites.md +++ b/topics/tutorials/build_system/gradle_prerequisites.md @@ -101,31 +101,31 @@ my_gradle_plugin The generated `my_gradle_plugin` project build.gradle file: ```groovy - plugins { - id 'java' - id 'org.jetbrains.intellij' version '1.4.0' - } +plugins { + id 'java' + id 'org.jetbrains.intellij' version '1.4.0' +} - group 'com.your.company' - version '1.0' - sourceCompatibility = 1.8 +group 'com.your.company' +version '1.0' +sourceCompatibility = 1.8 - repositories { - mavenCentral() - } - dependencies { - testImplementation group: 'junit', name: 'junit', version: '4.13.2' - } +repositories { + mavenCentral() +} +dependencies { + testImplementation group: 'junit', name: 'junit', version: '4.13.2' +} - // See https://github.com/JetBrains/gradle-intellij-plugin/ - intellij { - version = '2020.1.3' - } - patchPluginXml { - changeNotes = """ - Add change notes here.
- most HTML tags may be used""" - } +// See https://github.com/JetBrains/gradle-intellij-plugin/ +intellij { + version = '2020.1.3' +} +patchPluginXml { + changeNotes = """ + Add change notes here.
+ most HTML tags may be used""" +} ``` * Two plugins to Gradle are explicitly declared: diff --git a/topics/tutorials/custom_language_support/annotator.md b/topics/tutorials/custom_language_support/annotator.md index 6dc3984d3..ac595afe8 100644 --- a/topics/tutorials/custom_language_support/annotator.md +++ b/topics/tutorials/custom_language_support/annotator.md @@ -17,17 +17,16 @@ Beginning in version 2019.2, a dependency on Java plugin [must be declared expli First, add a dependency on the Java plugin in Gradle build file: - + -```groovy +```kotlin intellij { plugins = ['com.intellij.java'] } ``` - - + ```kotlin intellij {