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 {
35+ testImplementation(libs.junit)
2636 testImplementation(libs.junit5)
27- }
28-
29- // Set the JVM language level used to build the project.
30- kotlin {
31- jvmToolchain(17 )
32- }
3337
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" )
38+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
39+ intellijPlatform {
40+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
3941
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- }
42+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
43+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
4344
44- // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
45- changelog {
46- groups.empty()
47- repositoryUrl = properties(" pluginRepositoryUrl" )
48- }
45+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
46+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
4947
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- }
48+ instrumentationTools()
49+ pluginVerifier()
50+ zipSigner()
51+ testFramework(TestFrameworkType .Platform )
5852 }
5953}
6054
61- tasks {
62- wrapper {
63- gradleVersion = properties(" gradleVersion" ).get()
64- }
65-
66- buildSearchableOptions {
67- enabled = false
68- }
69-
70- patchPluginXml {
71- version = properties(" pluginVersion" )
72- sinceBuild = properties(" pluginSinceBuild" )
73- untilBuild = properties(" pluginUntilBuild" )
55+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
56+ intellijPlatform {
57+ pluginConfiguration {
58+ version = providers.gradleProperty(" pluginVersion" )
7459
7560 // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
76- pluginDescription = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
61+ description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
7762 val start = " <!-- Plugin description -->"
7863 val end = " <!-- Plugin description end -->"
7964
@@ -87,7 +72,7 @@ tasks {
8772
8873 val changelog = project.changelog // local variable for configuration cache compatibility
8974 // Get the latest available change notes from the changelog file
90- changeNotes = properties (" pluginVersion" ).map { pluginVersion ->
75+ changeNotes = providers.gradleProperty (" pluginVersion" ).map { pluginVersion ->
9176 with (changelog) {
9277 renderItem(
9378 (getOrNull(pluginVersion) ? : getUnreleased())
@@ -97,33 +82,82 @@ tasks {
9782 )
9883 }
9984 }
85+
86+ ideaVersion {
87+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
88+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
89+ }
10090 }
10191
102- // Configure UI tests plugin
103- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
104- runIdeForUiTests {
105- systemProperty(" robot-server.port" , " 8082" )
106- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
107- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
108- systemProperty(" jb.consents.confirmation.enabled" , " false" )
92+ signing {
93+ certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
94+ privateKey = providers.environmentVariable(" PRIVATE_KEY" )
95+ password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
96+ }
97+
98+ publishing {
99+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
100+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
101+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
102+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
103+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
104+ }
105+
106+ pluginVerification {
107+ ides {
108+ recommended()
109+ }
110+ }
111+ }
112+
113+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
114+ changelog {
115+ groups.empty()
116+ repositoryUrl = providers.gradleProperty(" pluginRepositoryUrl" )
117+ }
118+
119+ // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
120+ kover {
121+ reports {
122+ total {
123+ xml {
124+ onCheck = true
125+ }
126+ }
127+ }
128+ }
129+
130+ tasks {
131+ wrapper {
132+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
133+ }
134+
135+ buildSearchableOptions {
136+ enabled = false
109137 }
110138
111139 test {
112140 useJUnitPlatform()
113141 }
114142
115- signPlugin {
116- certificateChain = environment(" CERTIFICATE_CHAIN" )
117- privateKey = environment(" PRIVATE_KEY" )
118- password = environment(" PRIVATE_KEY_PASSWORD" )
143+ publishPlugin {
144+ dependsOn(patchChangelog)
119145 }
146+ }
120147
121- publishPlugin {
122- dependsOn(" patchChangelog" )
123- token = environment(" PUBLISH_TOKEN" )
124- // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
125- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
126- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
127- channels = properties(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
148+ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
149+ task {
150+ jvmArgumentProviders + = CommandLineArgumentProvider {
151+ listOf (
152+ " -Drobot-server.port=8082" ,
153+ " -Dide.mac.message.dialogs.as.sheets=false" ,
154+ " -Djb.privacy.policy.text=<!--999.999-->" ,
155+ " -Djb.consents.confirmation.enabled=false" ,
156+ )
157+ }
158+ }
159+
160+ plugins {
161+ robotServerPlugin(Constraints .LATEST_VERSION )
128162 }
129163}
0 commit comments