11import org.jetbrains.changelog.Changelog
22import org.jetbrains.changelog.markdownToHTML
3-
4- fun properties (key : String ) = providers.gradleProperty(key)
5- fun environment (key : String ) = providers.environmentVariable(key)
3+ import org.jetbrains.intellij.platform.gradle.Constants.Constraints
4+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
65
76plugins {
87 id(" java" ) // Java support
98 alias(libs.plugins.kotlin) // Kotlin support
10- alias(libs.plugins.gradleIntelliJPlugin ) // Gradle IntelliJ Plugin
9+ alias(libs.plugins.intelliJPlatform ) // IntelliJ Platform Gradle Plugin
1110 alias(libs.plugins.changelog) // Gradle Changelog Plugin
1211 alias(libs.plugins.qodana) // Gradle Qodana Plugin
1312 alias(libs.plugins.kover) // Gradle Kover Plugin
1413}
1514
16- group = properties(" pluginGroup" ).get()
17- version = properties(" pluginVersion" ).get()
15+ group = providers.gradleProperty(" pluginGroup" ).get()
16+ version = providers.gradleProperty(" pluginVersion" ).get()
17+
18+ // Set the JVM language level used to build the project.
19+ kotlin {
20+ jvmToolchain(17 )
21+ }
1822
1923// Configure project's dependencies
2024repositories {
2125 mavenCentral()
26+
27+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
28+ intellijPlatform {
29+ defaultRepositories()
30+ }
2231}
2332
2433// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
2534dependencies {
26- // implementation(libs.exampleLibrary)
27- }
35+ testImplementation(libs.junit)
2836
29- // Set the JVM language level used to build the project.
30- kotlin {
31- jvmToolchain(17 )
32- }
37+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
38+ intellijPlatform {
39+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
3340
34- // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
35- intellij {
36- pluginName = properties(" pluginName" )
37- version = properties(" platformVersion" )
38- type = properties(" platformType" )
41+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
42+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
3943
40- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
41- plugins = properties(" platformPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }
42- }
43-
44- // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
45- changelog {
46- groups.empty()
47- repositoryUrl = properties(" pluginRepositoryUrl" )
48- }
44+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
45+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
4946
50- // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
51- kover {
52- reports {
53- total {
54- xml {
55- onCheck = true
56- }
57- }
47+ instrumentationTools()
48+ pluginVerifier()
49+ zipSigner()
50+ testFramework(TestFrameworkType .Platform )
5851 }
5952}
6053
61- tasks {
62- wrapper {
63- gradleVersion = properties(" gradleVersion" ).get()
64- }
65-
66- patchPluginXml {
67- version = properties(" pluginVersion" )
68- sinceBuild = properties(" pluginSinceBuild" )
69- untilBuild = properties(" pluginUntilBuild" )
54+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
55+ intellijPlatform {
56+ pluginConfiguration {
57+ version = providers.gradleProperty(" pluginVersion" )
7058
7159 // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
72- pluginDescription = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
60+ description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
7361 val start = " <!-- Plugin description -->"
7462 val end = " <!-- Plugin description end -->"
7563
@@ -83,7 +71,7 @@ tasks {
8371
8472 val changelog = project.changelog // local variable for configuration cache compatibility
8573 // Get the latest available change notes from the changelog file
86- changeNotes = properties (" pluginVersion" ).map { pluginVersion ->
74+ changeNotes = providers.gradleProperty (" pluginVersion" ).map { pluginVersion ->
8775 with (changelog) {
8876 renderItem(
8977 (getOrNull(pluginVersion) ? : getUnreleased())
@@ -93,29 +81,74 @@ tasks {
9381 )
9482 }
9583 }
96- }
9784
98- // Configure UI tests plugin
99- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
100- runIdeForUiTests {
101- systemProperty(" robot-server.port" , " 8082" )
102- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
103- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
104- systemProperty(" jb.consents.confirmation.enabled" , " false" )
85+ ideaVersion {
86+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
87+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
88+ }
10589 }
10690
107- signPlugin {
108- certificateChain = environment (" CERTIFICATE_CHAIN" )
109- privateKey = environment (" PRIVATE_KEY" )
110- password = environment (" PRIVATE_KEY_PASSWORD" )
91+ signing {
92+ certificateChain = providers.environmentVariable (" CERTIFICATE_CHAIN" )
93+ privateKey = providers.environmentVariable (" PRIVATE_KEY" )
94+ password = providers.environmentVariable (" PRIVATE_KEY_PASSWORD" )
11195 }
11296
113- publishPlugin {
114- dependsOn(" patchChangelog" )
115- token = environment(" PUBLISH_TOKEN" )
97+ publishing {
98+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
11699 // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
117100 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
118101 // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
119- channels = properties(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
102+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
103+ }
104+
105+ pluginVerification {
106+ ides {
107+ recommended()
108+ }
109+ }
110+ }
111+
112+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
113+ changelog {
114+ groups.empty()
115+ repositoryUrl = providers.gradleProperty(" pluginRepositoryUrl" )
116+ }
117+
118+ // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
119+ kover {
120+ reports {
121+ total {
122+ xml {
123+ onCheck = true
124+ }
125+ }
126+ }
127+ }
128+
129+ tasks {
130+ wrapper {
131+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
132+ }
133+
134+ publishPlugin {
135+ dependsOn(patchChangelog)
136+ }
137+ }
138+
139+ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
140+ task {
141+ jvmArgumentProviders + = CommandLineArgumentProvider {
142+ listOf (
143+ " -Drobot-server.port=8082" ,
144+ " -Dide.mac.message.dialogs.as.sheets=false" ,
145+ " -Djb.privacy.policy.text=<!--999.999-->" ,
146+ " -Djb.consents.confirmation.enabled=false" ,
147+ )
148+ }
149+ }
150+
151+ plugins {
152+ robotServerPlugin(Constraints .LATEST_VERSION )
120153 }
121154}
0 commit comments