This project requires Gradle 4.9 or newer
This plugin allows you to build plugins for IntelliJ Platform using specified IntelliJ SDK and bundled/3rd-party plugins.
The plugin adds extra IntelliJ-specific dependencies, patches processResources
tasks to fill some tags
(name, version) in plugin.xml
with appropriate values, patches compile tasks to instrument code with
nullability assertions and forms classes made with IntelliJ GUI Designer and provides some build steps which might be
helpful while developing plugins for IntelliJ platform.
TIP Create new plugins with a preconfigured project scaffold and CI using IntelliJ Platform Plugin Template.
Here is the manual on how to start developing plugins for IntelliJ Platform using Gradle.
Also, please take a look at the FAQ.
plugins {
id "org.jetbrains.intellij" version "0.4.22"
}
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'https://dl.bintray.com/jetbrains/intellij-plugin-service'
}
}
dependencies {
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.5.0-SNAPSHOT"
}
}
apply plugin: 'org.jetbrains.intellij'
Plugin introduces the following tasks
Task | Description |
---|---|
buildPlugin |
Assembles plugin and prepares zip archive for deployment. |
patchPluginXml |
Collects all plugin.xml files in sources and fill since/until build and version attributes. |
downloadRobotServerPlugin |
Downloads robot-server plugin which is needed for ui tests running. |
prepareSandbox |
Creates proper structure of plugin, copies patched plugin xml files and fills sandbox directory with all of it. |
prepareTestingSandbox |
Prepares sandbox that will be used while running tests. |
prepareUiTestingSandbox |
Prepares sandbox that will be used while running ui tests. |
buildSearchableOptions |
Builds an index of UI components (a.k.a. searchable options) for the plugin by running a headless IDE instance. Note, that this is a runIde task with predefined arguments and all properties of runIde task are also applied to buildSearchableOptions tasks. |
jarSearchableOptions |
Creates a jar file with searchable options to be distributed with the plugin. |
runIde |
Executes an IntelliJ IDEA instance with the plugin you are developing. |
runIdeForUiTests |
Executes an IntelliJ IDEA instance ready for ui tests run with the plugin you are developing. See ui tests example to know more |
publishPlugin |
Uploads plugin distribution archive to https://plugins.jetbrains.com. |
verifyPlugin |
Validates completeness and contents of plugin.xml descriptors as well as plugin’s archive structure. |
Plugin provides the following options to configure target IntelliJ SDK and build archive
The following attributes are a part of the Setup DSL intellij { ... } in which allows you to setup the environment and dependencies.
Attributes | Values |
---|---|
pluginName - The name of the target zip-archive and defines the name of plugin artifact. | Acceptable Values: String - 'gradle-intellij-plugin' Default Value: $project.name |
Attributes | Values |
---|---|
version - The version of the IntelliJ Platform IDE that will be used to build the plugin. Please see Plugin Compatibility in SDK docs for more details. Notes:
|
Acceptable Values:
All available JetBrains IDEs versions can be found at IntelliJ Artifacts page. Default Value: 'LATEST-EAP-SNAPSHOT' |
type - The type of IDE distribution. | Acceptable Values:
|
localPath - The path to locally installed IDE distribution that should be used as a dependency. Notes:
|
Acceptable Values: path - '/Applications/IntelliJIDEA.app' Default Value: null |
plugins - The list of bundled IDE plugins and plugins from the JetBrains Plugin Repository. Please see Plugin Dependencies in SDK docs for more details. Notes:
|
Acceptable Values:
|
Attributes | Values |
---|---|
updateSinceUntilBuild - Should plugin patch plugin.xml with since and until build values? Notes:
|
Acceptable Values: true false Default Value: true |
sameSinceUntilBuild - Should plugin patch plugin.xml with an until build value that is just an "open" since build? Notes:
|
Acceptable Values: true false Default Value: false |
instrumentCode - Should plugin instrument java classes with nullability assertions and compile forms created by IntelliJ GUI Designer? | Acceptable Values: true false Default Value: true |
Attributes | Values |
---|---|
alternativeIdePath - The absolute path to the locally installed JetBrains IDE. Notes:
|
Acceptable Values: path - '/Applications/Android Studio.app' Default Value: none |
sandboxDirectory - The path of sandbox directory that is used for running IDE with developing plugin. | Acceptable Values: path - '${project.rootDir}/.sandbox' Default Value: '${project.buildDir}/idea-sandbox' |
Attributes | Values |
---|---|
intellijRepo, pluginsRepo, jreRepo - Urls of repositories for downloading IDE distributions, plugin dependencies and JetBrains Java Runtime. |
Acceptable Values: url Default Value: jetbrains.com/intellij-repository, plugins.jetbrains.com/maven, jetbrains.bintray.com/intellij-jdk |
downloadSources - Should plugin download IntelliJ sources while initializing Gradle build? Notes:
|
Acceptable Values: true false Default Value: true if CI environment variable is not set |
ideaDependencyCachePath - The absolute path to the local directory that should be used for storing IDE distributions. Notes:
|
Acceptable Values: path - '<example>' Default Value: none |
RunIde
tasks (both runIde
and buildSearchableOptions
) extend JavaExec Gradle task,
all configuration attributes of JavaExec
task can be used in RunIde
as well.
In addition to that, following attributes may be used to customize IDE running:
Attributes | Default Value |
---|---|
jbrVersion JetBrains Java runtime version to use when running the IDE with the plugin. | Acceptable Values: String - E.g. '8u112b752.4' , '8u202b1483.24' , or '11_0_2b159' . Prefixes jbrex , jbrx or jbr are allowed.All JetBrains Java versions are available at BinTray. Default Value: null for IDE < 2017.3, builtin java version for IDE >= 2017.3 |
ideDirectory Path to IDE distribution that will be used to run the IDE with the plugin. | path to IDE-dependency |
configDirectory Path to configuration directory. | ${intellij.sandboxDirectory}/config |
pluginsDirectory Path to plugins directory. | ${intellij.sandboxDirectory}/plugins |
systemDirectory Path to indexes directory. | ${intellij.sandboxDirectory}/system |
autoReloadPlugins Enable/disable auto-reload of dynamic plugins. | true for IDE >= 2020.2 |
The following attributes are a part of the Patching DSL patchPluginXml { ... } in which allows Gradle to patch specific attributes in a set of plugin.xml
files.
TIP To maintain and generate an up-to-date changelog, try using Gradle Changelog Plugin.
Attributes | Default Value |
---|---|
version is a value for the <version> tag. |
project.version |
sinceBuild is for the since-build attribute of the <idea-version> tag. |
intellij.version in Branch.Build.Fix format |
untilBuild is for the until-build attribute of the <idea-version> tag. |
intellij.version in Branch.Build.* format |
pluginDescription is for the <description> tag. |
none |
changeNotes is for the <change-notes> tag. |
none |
pluginXmlFiles is a collection of xml files to patch. | All plugin.xml files with <idea-plugin> |
destinationDir is a directory to store patched xml files. | '${project.buildDir}/patchedPluginXmlFiles' |
The following attributes are a part of the Publishing DSL publishPlugin { ... } in which allows Gradle to upload a working plugin to the JetBrains Plugin Repository. Note that you need to upload the plugin to the repository at least once manually (to specify options like the license, repository URL etc.) before uploads through Gradle can be used.
See the instruction on how to generate authentication token: https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html
See Publishing Plugins with Gradle tutorial for step-by-step instructions.
Attributes | Default Value |
---|---|
token Authentication token. | none |
channels List of channel names to upload plugin to. | [default] |
host URL host of a plugin repository. | https://plugins.jetbrains.com |
distributionFile Jar or Zip file of plugin to upload. | output of buildPlugin task |
The following attributes help you to tune instrumenting behaviour in instrumentCode { ... } block.
Attributes | Default Value |
---|---|
compilerVersion is a version of instrumenting compiler. It's used for non-IDEA plugins (e.g. CLion or Rider). | Build number of the IDE dependency |
plugins {
id "org.jetbrains.intellij" version "0.4.22"
}
intellij {
version 'IC-2020.1'
plugins = ['coverage', 'org.intellij.plugins.markdown:8.5.0.20160208']
pluginName 'MyPlugin'
}
publishPlugin {
token 'ssdfhasdfASDaq23jhnasdkjh'
channels 'nightly'
}
plugins {
id("org.jetbrains.intellij") version "0.4.22"
}
intellij {
version = "2020.1"
setPlugins("coverage", "org.intellij.plugins.markdown:8.5.0.20160208")
isDownloadSources = true
pluginName = "MyPlugin"
}
publishPlugin {
token = "ssdfhasdfASDaq23jhnasdkjh"
channels = "nightly"
}
As examples of using this plugin you can check out following projects:
- Go plugin and its TeamCity build configuration
- Erlang plugin and its TeamCity build configuration
- Rust plugin and its TeamCity build configuration
- AWS CloudFormation plugin and its TeamCity build configuration
- Bash plugin and its TeamCity build configuration
- Perl5 plugin and its Travis configuration file
- Bamboo Soy plugin and its Travis configuration file
- Android Drawable Importer plugin
- Android Material Design Icon Generator plugin
- AceJump plugin
- Uses the Gradle Kotlin DSL
- EmberJS plugin
- HCL plugin
- Robot plugin
- TOML plugin
- SQLDelight Android Studio Plugin
- idear plugin
- Uses the Gradle Kotlin DSL
- Android WiFi ADB plugin
- SonarLint plugin
- IdeaVim plugin and its TeamCity build configuration
- Adb Idea is configured to build and run against stable, beta or preview (canary) releases of Android Studio
- Gerrit uses Travis CI inclusive automated publishing of releases to GitHub and JetBrains plugin repository (triggered by version tag creation)
- .ignore
- Minecraft Development and its TeamCity build configuration
- Uses the Gradle Kotlin DSL
- Mixes Java, Kotlin, and Groovy code
- Uses Grammar Kit
- Uses a Kotlin version not bundled with IntelliJ IDEA
- Mainframer Integration
- Uses the Gradle Kotlin DSL
- Fully written in Kotlin
- Uses RxJava
- Unity 3D plugin for JetBrains Rider
- AEM Tools plugin for Adobe Experience Manager integration
- Uses the Gradle Kotlin DSL
- Fully written in Kotlin
- Uses template language
- F# plugin for JetBrains Rider
- Uses the Gradle Kotlin DSL
- Intellij Rainbow Brackets
- Fully written in Kotlin
- Uses other IntelliJ IDEA plugins as test dependencies
- Circle CI configuration file & Travis CI configuration file
- Gradle task to verify plugin compatibility cross IntelliJ Platform versions
- Auto subbmit anonymous feedback as github issues
Contributing tips:
You can debug the source code of gradle-intellij-plugin (e.g. put breakpoints there) if you add a reference to your local copy into settings.gradle
of your IntelliJ plugin:
includeBuild '/path/to/gradle-intellij-plugin'
Copyright 2020 org.jetbrains.intellij.plugins
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--
This README.md file was hand-crafted with care utilising synapticloop
templar
->
documentr
--