Build: Move writing ide plugin version to the idea module

This commit is contained in:
Vyacheslav Gerasimov
2020-03-05 20:05:35 +03:00
parent f3acb8dde2
commit d88134069d
2 changed files with 15 additions and 14 deletions
+15
View File
@@ -1,8 +1,12 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
kotlin("jvm")
id("jps-compatible")
}
val kotlinVersion: String by rootProject.extra
repositories {
maven("https://jetbrains.bintray.com/markdown")
}
@@ -181,6 +185,17 @@ dependencies {
}
tasks.named<Copy>("processResources") {
val currentIde = IdeVersionConfigurator.currentIde
val pluginPatchNumber = findProperty("pluginPatchNumber") as String? ?: "1"
val defaultPluginVersion = "$kotlinVersion-${currentIde.kind.shortName}${currentIde.platform.version}-$pluginPatchNumber"
val pluginVersion = findProperty("pluginVersion") as String? ?: defaultPluginVersion
inputs.property("pluginVersion", pluginVersion)
filesMatching("META-INF/plugin.xml") {
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to pluginVersion))
}
from(provider { project(":compiler:cli-common").mainSourceSet.resources }) {
include("META-INF/extensions/compiler.xml")
}
-14
View File
@@ -44,20 +44,6 @@ val writeStdlibVersion by tasks.registering {
}
}
val writePluginVersion by tasks.registering {
val versionFile = project(":idea").projectDir.resolve("resources/META-INF/plugin.xml")
val pluginVersion = rootProject.findProperty("pluginVersion") as String?
inputs.property("version", pluginVersion)
outputs.file(versionFile)
doLast {
requireNotNull(pluginVersion) { "Specify 'pluginVersion' property" }
replaceVersion(versionFile, """<version>([^<]+)</version>""") {
logger.lifecycle("Writing new plugin version: $pluginVersion")
pluginVersion!!
}
}
}
val writeVersions by tasks.registering {
dependsOn(writeBuildNumber, writeStdlibVersion)
}