Build: Move writing ide plugin version to the idea module
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user