1
1
import org.jetbrains.changelog.Changelog
2
2
import org.jetbrains.changelog.markdownToHTML
3
+ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
3
4
4
5
fun properties (key : String ) = providers.gradleProperty(key)
5
6
fun environment (key : String ) = providers.environmentVariable(key)
@@ -17,68 +18,58 @@ plugins {
17
18
group = properties(" pluginGroup" ).get()
18
19
version = properties(" pluginVersion" ).get()
19
20
21
+ // Set the JVM language level used to build the project.
22
+ kotlin {
23
+ jvmToolchain(17 )
24
+ }
25
+
20
26
// Configure project's dependencies
21
27
repositories {
22
28
mavenCentral()
29
+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
30
+ intellijPlatform {
31
+ defaultRepositories()
32
+ }
23
33
}
24
34
25
35
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
26
36
dependencies {
27
- // implementation(libs.annotations)
37
+ // implementation(libs.annotations)
28
38
// We need kotlinx-serialization-json >= 1.7.0 to support allowComments, as
29
39
// devcontainer.json files often have comments and therefore use
30
40
// nonstandard JSON syntax. This dependency should be marked compileOnly
31
41
// once the minimum IDE version we support (pluginSinceBuild in
32
42
// gradle.properties) is at least 251, which includes version 1.7.2.
33
43
implementation(" org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0" )
34
- }
35
44
36
- // Set the JVM language level used to build the project.
37
- kotlin {
38
- jvmToolchain(17 )
39
- }
45
+ testImplementation(" junit:junit:4.13.2" )
40
46
41
- // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
42
- intellij {
43
- pluginName = properties(" pluginName" )
44
- version = properties(" platformVersion" )
45
- type = properties(" platformType" )
47
+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
48
+ intellijPlatform {
49
+ intellijIdeaCommunity(providers.gradleProperty(" platformVersion" ))
46
50
47
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
48
- plugins = properties(" platformPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }
49
- }
50
-
51
- // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
52
- changelog {
53
- groups.empty()
54
- repositoryUrl = properties(" pluginRepositoryUrl" )
55
- }
51
+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
52
+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
56
53
57
- // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
58
- koverReport {
59
- defaults {
60
- xml {
61
- onCheck = true
62
- }
54
+ pluginVerifier()
63
55
}
64
56
}
65
57
66
- tasks {
67
- wrapper {
68
- gradleVersion = properties( " gradleVersion " ).get()
69
- }
58
+ // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
59
+ intellijPlatform {
60
+ buildSearchableOptions = true
61
+ instrumentCode = true
70
62
71
- patchPluginXml {
72
- version = properties(" pluginVersion" )
73
- sinceBuild = properties(" pluginSinceBuild" )
74
- untilBuild = properties(" pluginUntilBuild" )
63
+ pluginConfiguration {
64
+ name = providers.gradleProperty(" pluginName" )
65
+ version = providers.gradleProperty(" pluginVersion" )
75
66
76
67
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
77
- pluginDescription = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
68
+ description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
78
69
val start = " <!-- Plugin description -->"
79
70
val end = " <!-- Plugin description end -->"
80
71
81
- with (it.lines()) {
72
+ with (it.lines()) {
82
73
if (! containsAll(listOf (start, end))) {
83
74
throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
84
75
}
@@ -88,7 +79,7 @@ tasks {
88
79
89
80
val changelog = project.changelog // local variable for configuration cache compatibility
90
81
// Get the latest available change notes from the changelog file
91
- changeNotes = properties (" pluginVersion" ).map { pluginVersion ->
82
+ changeNotes = providers.gradleProperty (" pluginVersion" ).map { pluginVersion ->
92
83
with (changelog) {
93
84
renderItem(
94
85
(getOrNull(pluginVersion) ? : getUnreleased())
@@ -98,29 +89,93 @@ tasks {
98
89
)
99
90
}
100
91
}
92
+
93
+ ideaVersion {
94
+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
95
+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
96
+ }
101
97
}
102
98
103
- // Configure UI tests plugin
104
- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
105
- runIdeForUiTests {
106
- systemProperty(" robot-server.port" , " 8082" )
107
- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
108
- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
109
- systemProperty(" jb.consents.confirmation.enabled" , " false" )
99
+ pluginVerification {
100
+ ides {
101
+ providers.gradleProperty(" verifyVersions" ).get().split(' ,' ).map(String ::trim).forEach { version ->
102
+ ide(IntelliJPlatformType .IntellijIdeaCommunity , version)
103
+ }
104
+ }
110
105
}
111
106
112
- signPlugin {
107
+ signing {
113
108
certificateChain = environment(" CERTIFICATE_CHAIN" )
114
109
privateKey = environment(" PRIVATE_KEY" )
115
110
password = environment(" PRIVATE_KEY_PASSWORD" )
116
111
}
117
112
118
- publishPlugin {
119
- dependsOn(" patchChangelog" )
120
- token = environment(" PUBLISH_TOKEN" )
113
+ publishing {
114
+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
121
115
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
122
116
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
123
117
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
124
- channels = properties(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
118
+ channels = providers.gradleProperty(" pluginVersion" )
119
+ .map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
120
+ }
121
+ }
122
+
123
+
124
+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
125
+ changelog {
126
+ version.set(properties(" pluginVersion" ))
127
+ groups.set(emptyList())
128
+ }
129
+
130
+ // Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
131
+ kover {
132
+ reports {
133
+ total {
134
+ xml {
135
+ onCheck = true
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ // Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
142
+ qodana {
143
+ cachePath.set(projectDir.resolve(" .qodana" ).canonicalPath)
144
+ resultsPath.set(projectDir.resolve(" build/reports/inspections" ).canonicalPath)
145
+ }
146
+
147
+ tasks {
148
+ wrapper {
149
+ gradleVersion = properties(" gradleVersion" ).get()
150
+ }
151
+
152
+ buildPlugin {
153
+ archiveBaseName = providers.gradleProperty(" pluginName" ).get()
154
+ // exclude { "coroutines" in it.name }
155
+ }
156
+
157
+ publishPlugin {
158
+ dependsOn(patchChangelog)
125
159
}
126
160
}
161
+
162
+ intellijPlatformTesting {
163
+ runIde {
164
+ register(" runIdeForUiTests" ) {
165
+ task {
166
+ jvmArgumentProviders + = CommandLineArgumentProvider {
167
+ listOf (
168
+ " -Drobot-server.port=8082" ,
169
+ " -Dide.mac.message.dialogs.as.sheets=false" ,
170
+ " -Djb.privacy.policy.text=<!--999.999-->" ,
171
+ " -Djb.consents.confirmation.enabled=false" ,
172
+ )
173
+ }
174
+ }
175
+
176
+ plugins {
177
+ robotServerPlugin()
178
+ }
179
+ }
180
+ }
181
+ }
0 commit comments