1414 * limitations under the License.
1515 */
1616
17+ import org.jetbrains.changelog.Changelog
1718import org.jetbrains.changelog.markdownToHTML
19+ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
20+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
21+ import org.jetbrains.intellij.platform.gradle.models.ProductRelease
1822import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1923
2024fun properties (key : String ) = project.findProperty(key).toString()
@@ -25,29 +29,75 @@ plugins {
2529 // Kotlin support
2630 id(" org.jetbrains.kotlin.jvm" ) version " 1.9.10"
2731 // Gradle IntelliJ Plugin
28- id(" org.jetbrains.intellij" ) version " 1.16 .0"
32+ id(" org.jetbrains.intellij.platform " ) version " 2.1 .0"
2933 // Gradle Changelog Plugin
30- id(" org.jetbrains.changelog" ) version " 2.2.0 "
34+ id(" org.jetbrains.changelog" ) version " 2.2.1 "
3135 // Gradle Qodana Plugin
3236 id(" org.jetbrains.qodana" ) version " 0.1.13"
3337}
3438
3539group = properties(" pluginGroup" )
3640version = properties(" pluginVersion" )
3741
38- // Configure project's dependencies
39- repositories {
40- mavenCentral()
41- }
4242
43- // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
44- intellij {
45- pluginName.set(properties(" pluginName" ))
46- version.set(properties(" platformVersion" ))
47- type.set(properties(" platformType" ))
43+ intellijPlatform {
44+ pluginConfiguration {
45+ name = properties(" pluginName" )
46+ version = properties(" pluginVersion" )
47+ ideaVersion {
48+ sinceBuild = properties(" pluginSinceBuild" )
49+ untilBuild = properties(" pluginUntilBuild" )
50+ }
51+
4852
49- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
50- plugins.set(properties(" platformPlugins" ).split(' ,' ).map(String ::trim).filter(String ::isNotEmpty))
53+ description = projectDir.resolve(" README.md" ).readText().lines().run {
54+ val start = " <!-- Plugin description -->"
55+ val end = " <!-- Plugin description end -->"
56+ if (! containsAll(listOf (start, end))) {
57+ throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
58+ }
59+ subList(indexOf(start) + 1 , indexOf(end))
60+ }.joinToString(" \n " ).run { markdownToHTML(this ) }
61+
62+ changeNotes = provider {
63+ changelog.renderItem(
64+ changelog
65+ .get(properties(" pluginVersion" ))
66+ .withHeader(false )
67+ .withEmptySections(false ),
68+ Changelog .OutputType .HTML
69+ )
70+ }
71+ }
72+
73+ publishing {
74+ token = System .getenv(" PUBLISH_TOKEN" )
75+ channels = listOf (" default" )
76+ }
77+
78+ signing {
79+ certificateChain = System .getenv(" CERTIFICATE_CHAIN" )
80+ privateKey = System .getenv(" PRIVATE_KEY" )
81+ password = System .getenv(" PRIVATE_KEY_PASSWORD" )
82+ }
83+
84+ pluginVerification {
85+ ides {
86+ select {
87+ types = listOf (IntelliJPlatformType .IntellijIdeaCommunity )
88+ channels = listOf (ProductRelease .Channel .RELEASE , ProductRelease .Channel .EAP )
89+ sinceBuild = properties(" pluginSinceBuild" )
90+ untilBuild = properties(" pluginUntilBuild" )
91+ }
92+ }
93+
94+ freeArgs = listOf (
95+ // Mute some inspections that should be ignored (as we already uploaded and the id can't be changed)
96+ " -mute" , " TemplateWordInPluginId,ForbiddenPluginIdPrefix"
97+ )
98+
99+
100+ }
51101}
52102
53103// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
@@ -76,59 +126,6 @@ tasks {
76126 }
77127 }
78128
79- wrapper {
80- gradleVersion = properties(" gradleVersion" )
81- }
82-
83- patchPluginXml {
84- version.set(properties(" pluginVersion" ))
85- sinceBuild.set(properties(" pluginSinceBuild" ))
86- untilBuild.set(properties(" pluginUntilBuild" ))
87-
88- // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
89- pluginDescription.set(
90- projectDir.resolve(" README.md" ).readText().lines().run {
91- val start = " <!-- Plugin description -->"
92- val end = " <!-- Plugin description end -->"
93-
94- if (! containsAll(listOf (start, end))) {
95- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
96- }
97- subList(indexOf(start) + 1 , indexOf(end))
98- }.joinToString(" \n " ).run { markdownToHTML(this ) }
99- )
100-
101- // Get the latest available change notes from the changelog file
102- changeNotes.set(provider {
103- changelog.run {
104- getOrNull(properties(" pluginVersion" )) ? : getLatest()
105- }.toHTML()
106- })
107- }
108-
109- // Configure UI tests plugin
110- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
111- runIdeForUiTests {
112- systemProperty(" robot-server.port" , " 8082" )
113- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
114- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
115- systemProperty(" jb.consents.confirmation.enabled" , " false" )
116- }
117-
118- signPlugin {
119- certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
120- privateKey.set(System .getenv(" PRIVATE_KEY" ))
121- password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
122- }
123-
124- publishPlugin {
125- dependsOn(" patchChangelog" )
126- token.set(System .getenv(" PUBLISH_TOKEN" ))
127- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
128- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
129- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
130- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
131- }
132129 runIde {
133130 jvmArgs(" -Xmx2G" )
134131 }
@@ -140,11 +137,31 @@ tasks {
140137}
141138
142139dependencies {
140+ intellijPlatform {
141+ intellijIdeaCommunity(properties(" platformVersion" ))
142+ bundledPlugin(" com.intellij.java" )
143+ bundledPlugin(" org.jetbrains.kotlin" )
144+ pluginVerifier()
145+ zipSigner()
146+ instrumentationTools()
147+
148+ testFramework(TestFrameworkType .Plugin .Java )
149+ }
150+
143151 implementation(" io.sentry:sentry:6.32.0" )
144152
153+ testImplementation(" junit:junit:4.13.2" )
145154 testImplementation(" org.axonframework:axon-modelling:${properties(" axonVersion" )} " )
146155 testImplementation(" org.axonframework:axon-messaging:${properties(" axonVersion" )} " )
147156 testImplementation(" org.axonframework:axon-eventsourcing:${properties(" axonVersion" )} " )
148157 testImplementation(" org.axonframework:axon-configuration:${properties(" axonVersion" )} " )
149158 testImplementation(" org.assertj:assertj-core:3.24.2" )
150159}
160+
161+ // Configure project's dependencies
162+ repositories {
163+ mavenCentral()
164+ intellijPlatform {
165+ defaultRepositories()
166+ }
167+ }
0 commit comments