@@ -19,13 +19,24 @@ version = properties("pluginVersion").get()
1919// Configure project's dependencies
2020repositories {
2121 mavenCentral()
22+
23+ intellijPlatform {
24+ defaultRepositories()
25+ }
2226}
2327
2428// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
2529dependencies {
2630 implementation(libs.annotations)
2731 implementation(libs.jackson)
2832 implementation(libs.flexmark)
33+
34+ intellijPlatform {
35+ intellijIdeaCommunity(properties(" platformVersion" ))
36+ // Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
37+ // Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
38+ bundledPlugin(" com.intellij.java" )
39+ }
2940}
3041
3142// Set the JVM language level used to build the project. We are using Java 17 for 2022.2+.
@@ -40,16 +51,71 @@ java {
4051 }
4152}
4253
43- // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
44- intellij {
45- pluginName = properties(" pluginName" )
46- version = properties(" platformVersion" )
47- type = properties(" platformType" )
54+ intellijPlatform {
55+ projectName = project.name
56+
57+ // required for Auto-Reload development mode
58+ buildSearchableOptions = false
59+
60+ pluginConfiguration {
61+ name = properties(" pluginName" ).get()
62+ version = properties(" pluginVersion" ).get()
63+
64+ ideaVersion {
65+ sinceBuild = properties(" pluginSinceBuild" )
66+ untilBuild = properties(" pluginUntilBuild" )
67+ }
68+
69+ description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
70+ val start = " <!-- Plugin description -->"
71+ val end = " <!-- Plugin description end -->"
72+
73+ with (it.lines()) {
74+ if (! containsAll(listOf (start, end))) {
75+ throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
76+ }
77+ subList(indexOf(start) + 1 , indexOf(end)).joinToString(" \n " ).let (::markdownToHTML)
78+ }
79+ }
80+
81+ val changelog = project.changelog // local variable for configuration cache compatibility
82+ // Get the latest available change notes from the changelog file
83+ changeNotes = properties(" pluginVersion" ).map { pluginVersion ->
84+ with (changelog) {
85+ renderItem(
86+ (getOrNull(pluginVersion) ? : getUnreleased())
87+ .withHeader(false )
88+ .withEmptySections(false ),
89+ Changelog .OutputType .HTML ,
90+ )
91+ }
92+ }
93+ }
94+
95+ publishing {
96+ token = environment(" PUBLISH_TOKEN" )
97+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
98+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
99+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
100+ channels.set(
101+ properties(" pluginVersion" ).map { pluginVersion: String ->
102+ val channel = pluginVersion.substringAfter(' -' , " default" ).substringBefore(' .' )
103+ listOf<String >(channel)
104+ }
105+ )
106+ }
48107
49- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
50- plugins = properties(" platformPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }
108+ signing {
109+ certificateChain = environment(" CERTIFICATE_CHAIN" )
110+ privateKey = environment(" PRIVATE_KEY" )
111+ password = environment(" PRIVATE_KEY_PASSWORD" )
112+ }
51113
52- updateSinceUntilBuild = false
114+ pluginVerification {
115+ ides {
116+ recommended()
117+ }
118+ }
53119}
54120
55121// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
@@ -86,70 +152,33 @@ tasks {
86152 gradleVersion = properties(" gradleVersion" ).get()
87153 }
88154
89- patchPluginXml {
90- version = properties(" pluginVersion" )
91- sinceBuild = properties(" pluginSinceBuild" )
92- untilBuild = properties(" pluginUntilBuild" )
93-
94- // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
95- pluginDescription = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
96- val start = " <!-- Plugin description -->"
97- val end = " <!-- Plugin description end -->"
98-
99- with (it.lines()) {
100- if (! containsAll(listOf (start, end))) {
101- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
102- }
103- subList(indexOf(start) + 1 , indexOf(end)).joinToString(" \n " ).let (::markdownToHTML)
104- }
105- }
106-
107- val changelog = project.changelog // local variable for configuration cache compatibility
108- // Get the latest available change notes from the changelog file
109- changeNotes = properties(" pluginVersion" ).map { pluginVersion ->
110- with (changelog) {
111- renderItem(
112- (getOrNull(pluginVersion) ? : getUnreleased())
113- .withHeader(false )
114- .withEmptySections(false ),
115- Changelog .OutputType .HTML ,
116- )
117- }
118- }
119- }
120-
121- // Configure UI tests plugin
122- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
123- runIdeForUiTests {
124- systemProperty(" robot-server.port" , " 8082" )
125- systemProperty(" ide.mac.message.dialogs.as.sheets" , " false" )
126- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
127- systemProperty(" jb.consents.confirmation.enabled" , " false" )
128- }
129-
130155 runIde {
131- systemProperty(" idea.log.debug.categories" , " com.cycode.plugin" )
132- }
133-
134- signPlugin {
135- certificateChain = environment(" CERTIFICATE_CHAIN" )
136- privateKey = environment(" PRIVATE_KEY" )
137- password = environment(" PRIVATE_KEY_PASSWORD" )
156+ jvmArgumentProviders + = CommandLineArgumentProvider {
157+ listOf (
158+ " -Didea.log.debug.categories=com.cycode.plugin"
159+ )
160+ }
138161 }
162+ }
139163
140- publishPlugin {
141- dependsOn( " patchChangelog " )
142- dependsOn( " sentryUploadSourceBundleJava " )
143- token = environment( " PUBLISH_TOKEN " )
144- // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
145- // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
146- // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
147- channels =
148- properties( " pluginVersion " ).map { listOf (it.split( ' - ' ).getOrElse( 1 ) { " default " }.split( ' . ' ).first()) }
164+ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
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+ )
149173 }
174+ }
150175
151- buildSearchableOptions {
152- // required for Auto-Reload development mode
153- enabled = false
154- }
176+ plugins {
177+ robotServerPlugin()
178+ }
155179}
180+
181+ tasks.named(" publishPlugin" ) {
182+ dependsOn(" patchChangelog" )
183+ dependsOn(" sentryUploadSourceBundleJava" )
184+ }
0 commit comments