1
1
import org.jetbrains.changelog.Changelog
2
2
import 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
6
5
7
6
plugins {
8
7
id(" java" ) // Java support
9
8
alias(libs.plugins.kotlin) // Kotlin support
10
- alias(libs.plugins.gradleIntelliJPlugin ) // Gradle IntelliJ Plugin
9
+ alias(libs.plugins.intelliJPlatform ) // IntelliJ Platform Gradle Plugin
11
10
alias(libs.plugins.changelog) // Gradle Changelog Plugin
12
11
alias(libs.plugins.qodana) // Gradle Qodana Plugin
13
12
alias(libs.plugins.kover) // Gradle Kover Plugin
14
13
}
15
14
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
+ }
18
22
19
23
// Configure project's dependencies
20
24
repositories {
21
25
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
+ }
22
31
}
23
32
24
33
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
25
34
dependencies {
26
- // implementation(libs.exampleLibrary)
27
- }
35
+ testImplementation(libs.junit)
28
36
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" ))
33
40
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(' ,' ) })
39
43
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(' ,' ) })
49
46
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 )
58
51
}
59
52
}
60
53
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" )
70
58
71
59
// 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 {
73
61
val start = " <!-- Plugin description -->"
74
62
val end = " <!-- Plugin description end -->"
75
63
@@ -83,7 +71,7 @@ tasks {
83
71
84
72
val changelog = project.changelog // local variable for configuration cache compatibility
85
73
// Get the latest available change notes from the changelog file
86
- changeNotes = properties (" pluginVersion" ).map { pluginVersion ->
74
+ changeNotes = providers.gradleProperty (" pluginVersion" ).map { pluginVersion ->
87
75
with (changelog) {
88
76
renderItem(
89
77
(getOrNull(pluginVersion) ? : getUnreleased())
@@ -93,29 +81,74 @@ tasks {
93
81
)
94
82
}
95
83
}
96
- }
97
84
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
+ }
105
89
}
106
90
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" )
111
95
}
112
96
113
- publishPlugin {
114
- dependsOn(" patchChangelog" )
115
- token = environment(" PUBLISH_TOKEN" )
97
+ publishing {
98
+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
116
99
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
117
100
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
118
101
// 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 )
120
153
}
121
154
}
0 commit comments