diff --git a/images/tutorials/build_system/img/gradle_tasks_in_tool_window.png b/images/tutorials/build_system/img/gradle_tasks_in_tool_window.png deleted file mode 100644 index 41917e8f0..000000000 Binary files a/images/tutorials/build_system/img/gradle_tasks_in_tool_window.png and /dev/null differ diff --git a/images/tutorials/build_system/img/step1_new_gradle_project.png b/images/tutorials/build_system/img/step1_new_gradle_project.png deleted file mode 100644 index ec206a9fe..000000000 Binary files a/images/tutorials/build_system/img/step1_new_gradle_project.png and /dev/null differ diff --git a/topics/products/androidstudio/android_studio.md b/topics/products/androidstudio/android_studio.md index ff987aeeb..859ba8e4e 100644 --- a/topics/products/androidstudio/android_studio.md +++ b/topics/products/androidstudio/android_studio.md @@ -13,7 +13,7 @@ Android Studio plugins are not Android modules or apps to run in the Android ope To create a new Android Studio plugin project, follow the tutorial on the [Getting Started with Gradle](gradle_prerequisites.md) page. The tutorial produces a skeleton project suitable to use as a starting point for an Android Studio plugin. -On the [New Project Configuration Screen](gradle_prerequisites.md#new-project-configuration-screen) of the New Project Wizard tutorial, choose Gradle from the product category pane as described in the tutorial, **not** _Android_. +On the [New Project Screen](gradle_prerequisites.md#create-ide-plugin), choose IDE Plugin from the project generators list as described in the tutorial, **not** Android. Some minor modifications to the skeleton project are needed, as discussed below. ### Matching Versions of the IntelliJ Platform with the Android Studio Version diff --git a/topics/tutorials/build_system/gradle_prerequisites.md b/topics/tutorials/build_system/gradle_prerequisites.md index 5213cef35..641bbb493 100644 --- a/topics/tutorials/build_system/gradle_prerequisites.md +++ b/topics/tutorials/build_system/gradle_prerequisites.md @@ -1,150 +1,141 @@ [//]: # (title: Getting Started with Gradle) - + Gradle is the preferred solution for creating IntelliJ Platform plugins. The IntelliJ IDEA Ultimate and Community editions bundle the necessary plugins to support Gradle-based development. These IntelliJ IDEA plugins are _Gradle_ and _Plugin DevKit_, which are enabled by default. To verify these plugins are installed and enabled, see the help section about [Managing Plugins](https://www.jetbrains.com/help/idea/managing-plugins.html). -> [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template) makes it easier to create and maintain your IDE plugins, having the Gradle plugin already integrated and CI covered with GitHub Actions. -> -{type="tip"} - -> When adding additional repositories to your Gradle build script, always use the HTTPS protocol. -> -{type="warning"} - ## Creating a Gradle-Based IntelliJ Platform Plugin with New Project Wizard -Creating new Gradle-based IntelliJ Platform plugin projects is performed using the [New Project Wizard](https://www.jetbrains.com/help/idea/gradle.html#project_create_gradle). -The Wizard creates all the necessary project files based on a few template inputs. +Creating new Gradle-based IntelliJ Platform plugin projects is performed using the dedicated generator available in the [New Project Wizard](https://www.jetbrains.com/help/idea/new-project-wizard.html). +The generator creates all the necessary project files based on a few template inputs. -Before creating a new Gradle project, familiarize yourself with the [Creating a new Gradle project](https://www.jetbrains.com/help/idea/getting-started-with-gradle.html#create_gradle_project) help topic, which is a tutorial for creating general Gradle projects in IntelliJ IDEA. -This page emphasizes the steps in the process of creating IntelliJ Platform plugin projects that are Gradle-based. -Additionally, the [Working with Gradle in IntelliJ IDEA](https://www.youtube.com/watch?v=6V6G3RyxEMk) screencast offers a thorough introduction. + - ### Components of a Wizard-Generated Gradle IntelliJ Platform Plugin -For the [example](#creating-a-gradle-based-intellij-platform-plugin-with-new-project-wizard) `my_gradle_plugin`, the New Project Wizard creates the following directory content: +For the [example](#creating-a-gradle-based-intellij-platform-plugin-with-new-project-wizard) `my_plugin`, the _IDE Plugin_ generator creates the following directory content: ```text -my_gradle_plugin -├── build.gradle +my_plugin +├── .run +│ └── Run IDE with Plugin.run.xml ├── gradle │ └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties +├── src +│ ├── main +│ │ ├── java +│ │ └── resources +│ │ └── META-INF +│ │ └── plugin.xml +│ └── test +│ ├── java +│ └── resources +├── .gitignore +├── build.gradle.kts ├── gradlew ├── gradlew.bat -├── settings.gradle -└── src - ├── main - │ ├── java - │ └── resources - │ └── META-INF - │ └── plugin.xml - └── test - ├── java - └── resources +└── settings.gradle.kts ``` -* The default IntelliJ Platform build.gradle file (see next paragraph). +* The default IntelliJ Platform build.gradle.kts file (see next paragraph). +* The settings.gradle.kts file, containing a definition of the `rootProject.name`. * The Gradle Wrapper files, and in particular the gradle-wrapper.properties file, which specifies the version of Gradle to be used to build the plugin. If needed, the IntelliJ IDEA Gradle plugin downloads the version of Gradle specified in this file. -* The settings.gradle file, containing a definition of the `rootProject.name`. -* The META-INF directory under the default `main` [SourceSet](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) contains the plugin [configuration file](plugin_configuration_file.md). +* The META-INF directory under the default `main` [source set](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) contains the plugin [configuration file](plugin_configuration_file.md). +* The _Run Plugin_ [run configuration](https://www.jetbrains.com/help/idea/run-debug-configuration.html). -> Please note: the generated build.gradle file needs to be adjusted as shown below, as IntelliJ IDEA currently generates template incompatible with [Gradle IntelliJ Plugin](tools_gradle_intellij_plugin.md) 1.0 release. -> See [Upgrade Instructions](https://lp.jetbrains.com/gradle-intellij-plugin/) for more details. -> -{type="warning"} +The generated `my_plugin` project build.gradle.kts file: -The generated `my_gradle_plugin` project build.gradle file: - -```groovy +```kotlin plugins { - id 'java' - id 'org.jetbrains.intellij' version '1.5.2' + id("java") + id("org.jetbrains.intellij") version "1.6.0" } -group 'com.example.mycompany' -version '1.0' -sourceCompatibility = 1.8 +group = "com.example" +version = "1.0-SNAPSHOT" repositories { mavenCentral() } -dependencies { - testImplementation group: 'junit', name: 'junit', version: '4.13.2' + +// Configure Gradle IntelliJ Plugin +// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +intellij { + version.set("2021.3") + type.set("IC") // Target IDE Platform + + plugins.set(listOf(/* Plugin Dependencies */)) } -// 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""" +tasks { + // Set the JVM compatibility versions + withType { + sourceCompatibility = "11" + targetCompatibility = "11" + } + + patchPluginXml { + sinceBuild.set("213") + untilBuild.set("223.*") + } + + signPlugin { + certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) + privateKey.set(System.getenv("PRIVATE_KEY")) + password.set(System.getenv("PRIVATE_KEY_PASSWORD")) + } + + publishPlugin { + token.set(System.getenv("PUBLISH_TOKEN")) + } } ``` -* Two plugins to Gradle are explicitly declared: +* Two Gradle plugins are explicitly declared: * The [Gradle Java](https://docs.gradle.org/current/userguide/java_plugin.html) plugin. * The [Gradle IntelliJ Plugin](tools_gradle_intellij_plugin.md). -* The GroupId from the Wizard [Project Naming/Artifact Coordinates Screen](#project-namingartifact-coordinates-screen) is the `project.group` value. -* The Version from the Wizard [Project Naming/Artifact Coordinates Screen](#project-namingartifact-coordinates-screen) is the `project.version` value. -* The `sourceCompatibility` line is injected to enforce using Java 8 JDK to compile Java sources. -* The value of the [`intellij.version`](tools_gradle_intellij_plugin.md#intellij-extension-version) property specifies the version of the IntelliJ Platform to be used to build the plugin. - It defaults to the version of IntelliJ IDEA that was used to run the New Project Wizard. -* The value of the [`patchPluginXml.changeNotes`](tools_gradle_intellij_plugin.md#patchpluginxml-task-changenotes) property is set to a placeholder text. +* The Group from the [New Project](#create-ide-plugin) wizard is the `project.group` value. +* The `sourceCompatibility` line is injected to enforce using Java 11 JDK to compile Java sources. +* The values of the [`intellij.version`](tools_gradle_intellij_plugin.md#intellij-extension-version) and [`intellij.type`](tools_gradle_intellij_plugin.md#intellij-extension-type) properties specify the version and type of the IntelliJ Platform to be used to build the plugin. +* The empty placeholder list for [plugin dependencies](tools_gradle_intellij_plugin.md#intellij-extension-plugins). +* The values of the [`patchPluginXml.sinceBuild`](tools_gradle_intellij_plugin.md#patchpluginxml-task-sincebuild) and [`patchPluginXml.untilBuild`](tools_gradle_intellij_plugin.md#patchpluginxml-task-untilbuild) properties specifying the minimum and maximum versions of the IDE build the plugin is compatible with. +* The initial [`signPlugin`](tools_gradle_intellij_plugin.md#signplugin-task) and [`publishPlugin`](tools_gradle_intellij_plugin.md#publishplugin-task) tasks configuration. + See the [](deployment.md) section for more information. + +> Consider using the [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template) which uses the Gradle setup and provides CI setup covered with GitHub Actions. +> +{type="tip"} #### Plugin Gradle Properties and Plugin Configuration File Elements @@ -153,7 +144,7 @@ There is no IntelliJ Platform-related reason they should as they serve different The `` element (used as the plugin's display name) is often the same as `rootProject.name`, but it can be more explanatory. -The `` value must be a unique identifier over all plugins, typically a concatenation of the specified GroupId and ArtifactId. +The `` value must be a unique identifier over all plugins, typically a concatenation of the specified Group and Artifact. Please note that it is impossible to change the `` of a published plugin without losing automatic updates for existing installations. ## Adding Gradle Support to an Existing DevKit-Based IntelliJ Platform Plugin @@ -168,17 +159,15 @@ Converting a [DevKit-based](using_dev_kit.md) plugin project to a Gradle-based p * .idea directory * [modulename].iml file * out directory -* Arrange the existing source files within the project directory in the Gradle [SourceSet](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) format. +* Arrange the existing source files within the project directory in the Gradle [source set](https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_project_layout) format. * Use the New Project Wizard as though creating a [new Gradle project](#creating-a-gradle-based-intellij-platform-plugin-with-new-project-wizard) from scratch. -* On the [Project Naming/Artifact Coordinates Screen](#project-namingartifact-coordinates-screen) set the values of: - * GroupId to the existing package in the initial source set. - * ArtifactId to the name of the existing plugin. - * Version to the same as the existing plugin. - * Name to the name of the existing plugin. - (It should be pre-filled from the ArtifactId) - * Location to the directory of the existing plugin. +* On the [New Project](#create-ide-plugin) choose the IDE Plugin generator and set the values of: + * Group to the existing package in the initial source set. + * Artifact to the name of the existing plugin. + * Name to the name of the directory where the existing plugin is located, e.g. if the plugin project base directory is /Users/john/Projects/old_plugin, it should be the old_plugin. + * Location to the name of the plugin's parent directory, e.g. if the plugin project base directory is /Users/john/Projects/old_plugin, it should be the /Users/john/Projects. * Click Finish to create the new Gradle-based plugin. -* [Add more modules](https://www.jetbrains.com/help/idea/gradle.html#gradle_add_module) using Gradle [Source Sets](https://www.jetbrains.com/help/idea/gradle.html#gradle_source_sets) as needed. +* [Add more modules](https://www.jetbrains.com/help/idea/gradle.html#gradle_add_module) using Gradle [source sets](https://www.jetbrains.com/help/idea/gradle.html#gradle_source_sets) as needed. ## Running a Simple Gradle-Based IntelliJ Platform Plugin @@ -186,18 +175,21 @@ Gradle projects are run from the IDE's Gradle Tool window. ### Adding Code to the Project -Before running [`my_gradle_project`](#components-of-a-wizard-generated-gradle-intellij-platform-plugin), some code can be added to provide simple functionality. +Before running [`my_plugin`](#components-of-a-wizard-generated-gradle-intellij-platform-plugin), some code can be added to provide simple functionality. See the [Creating Actions](working_with_custom_actions.md) tutorial for step-by-step instructions for adding a menu action. ### Executing the Plugin -Open the Gradle tool window and search for the runIde task: -* If it's not on the list, hit the [Refresh](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#1eeec055) button at the top of the Gradle tool window. -* Or [Create a new Gradle Run Configuration](https://www.jetbrains.com/help/idea/create-run-debug-configuration-gradle-tasks.html). +The _IDE Plugin_ generator automatically creates the _Run Plugin_ run configuration that can be executed via the Run | Run... action or can be found in the Gradle tool window under the Run Configurations node. -![Gradle Tool Window](gradle_tasks_in_tool_window.png){width="398"} +To execute the Gradle `runIde` task directly, open the Gradle tool window and search for the runIde task under the Tasks node. +If it's not on the list, hit the re-import button in the [toolbar](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#1eeec055) at the top of the Gradle tool window. +When the runIde task is visible, double-click it to execute. -Double-click on the runIde task to execute it. -See the IntelliJ IDEA help for more information about [Working with Gradle tasks](https://www.jetbrains.com/help/idea/gradle.html#96bba6c3). +> See the IntelliJ IDEA help for more information about [Gradle tasks](https://www.jetbrains.com/help/idea/work-with-gradle-tasks.html). To debug your plugin in a _standalone_ IDE instance, please see [How to Debug Your Own IntelliJ IDEA Instance](https://medium.com/agorapulse-stories/how-to-debug-your-own-intellij-idea-instance-7d7df185a48d) blog post. + +> See the [Working with Gradle in IntelliJ IDEA](https://www.youtube.com/watch?v=6V6G3RyxEMk) screencast for more information about how to work with Gradle-based projects. +> +{type="tip"} diff --git a/topics/tutorials/custom_language_support/structure_aware_navbar.md b/topics/tutorials/custom_language_support/structure_aware_navbar.md index 21ed1b690..37455ee6e 100644 --- a/topics/tutorials/custom_language_support/structure_aware_navbar.md +++ b/topics/tutorials/custom_language_support/structure_aware_navbar.md @@ -34,7 +34,7 @@ configuration file using the `com.intellij.navbar` extension point. ## Run the Project Run the project by using the Gradle -[runIde task](https://plugins.jetbrains.com/docs/intellij/gradle-prerequisites.html#running-a-simple-gradle-based-intellij-platform-plugin). +[runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). Open the test.simple file and position the caret on any property. The navigation bar displays the name and icon of this property.