@@ -44,7 +44,7 @@ intellij {
4444
4545// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
4646changelog {
47- version.set(properties( " pluginVersion " ))
47+ version.set(project.semanticVersion.version.get().toString( ))
4848 path.set(" ${project.projectDir} /CHANGELOG.md" )
4949 // groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
5050 groups.set(emptyList())
@@ -64,7 +64,7 @@ qodana {
6464
6565project.afterEvaluate{
6666 // the final plugin distribution is packaged from the sandbox.
67- // So,make all the sub projects buildPlugin task run before this project's buildPlugin.
67+ // So,make all the subprojects buildPlugin task run before this project's buildPlugin.
6868 // that will make sure that their prepareSandbox task runs before building the plugin coz
6969 // maybe they contribute something to the sandbox.
7070 // currently, only rider contributes the dotnet dll's to the sandbox.
@@ -81,8 +81,12 @@ project.afterEvaluate{
8181
8282tasks {
8383
84+ incrementSemanticVersion {
85+ // enable the SemanticVersion only for this module
86+ enabled = true
87+ }
8488
85- jar{
89+ jar {
8690 dependsOn(" :rider:copyKotlinModuleFile" )
8791 }
8892
@@ -93,27 +97,27 @@ tasks {
9397 }
9498
9599 patchPluginXml {
96- version.set(properties( " pluginVersion " ))
100+ version.set(project.semanticVersion.version.get().toString( ))
97101 sinceBuild.set(properties(" pluginSinceBuild" ))
98102 untilBuild.set(properties(" pluginUntilBuild" ))
99103
100104 // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
101105 pluginDescription.set(
102- projectDir.resolve(" README.md" ).readText().lines().run {
103- val start = " <!-- Plugin description -->"
104- val end = " <!-- Plugin description end -->"
105-
106- if (! containsAll(listOf (start, end))) {
107- throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
108- }
109- subList(indexOf(start) + 1 , indexOf(end))
110- }.joinToString(" \n " ).run { markdownToHTML(this ) }
106+ projectDir.resolve(" README.md" ).readText().lines().run {
107+ val start = " <!-- Plugin description -->"
108+ val end = " <!-- Plugin description end -->"
109+
110+ if (! containsAll(listOf (start, end))) {
111+ throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
112+ }
113+ subList(indexOf(start) + 1 , indexOf(end))
114+ }.joinToString(" \n " ).run { markdownToHTML(this ) }
111115 )
112116
113117 // Get the latest available change notes from the changelog file
114118 changeNotes.set(provider {
115119 changelog.run {
116- getOrNull(properties( " pluginVersion " )) ? : getLatest()
120+ getOrNull(project.semanticVersion.version.get().toString( )) ? : getLatest()
117121 }.toHTML()
118122 })
119123 }
@@ -177,22 +181,30 @@ tasks {
177181
178182 signPlugin {
179183 if (System .getenv(" DIGMA_JB_PRIVATE_KEY_PASSWORD" ) != null ) {
180- certificateChainFile .set(file( System .getenv(" DIGMA_JB_CERTIFICATE_CHAIN_FILE" )))
181- privateKeyFile .set(file( System .getenv(" DIGMA_JB_PRIVATE_KEY_FILE" )))
182- password.set(System .getenv(" DIGMA_JB_PRIVATE_KEY_PASSWORD" ))
184+ certificateChain .set(System .getenv(" DIGMA_JB_CERTIFICATE_CHAIN_FILE" ).trimIndent( ))
185+ privateKey .set(System .getenv(" DIGMA_JB_PRIVATE_KEY_FILE" ).trimIndent( ))
186+ password.set(System .getenv(" DIGMA_JB_PRIVATE_KEY_PASSWORD" ).trim() )
183187 }
184188 }
185189
186190
187191 publishPlugin {
188192 if (System .getenv(" PUBLISH_TOKEN" ) != null ) {
189- token.set(System .getenv(" PUBLISH_TOKEN" ))
193+ token.set(System .getenv(" PUBLISH_TOKEN" ).trim() )
190194 }
191195
192- // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
196+ // the version is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
193197 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
194198 // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
195- channels.set(listOf (properties(" pluginVersion" ).split(' -' ).getOrElse(1 ) { " default" }.split(' .' ).first()))
199+ channels.set(listOf (project.semanticVersion.version.get().toString().split(' -' ).getOrElse(1 ) { " default" }
200+ .split(' .' ).first()))
201+ }
202+
203+
204+ create(" printVersion" , DefaultTask ::class .java) {
205+ doLast {
206+ println (" The project current version is ${project.semanticVersion.version.get()} " )
207+ }
196208 }
197209
198210}
0 commit comments