Extract current Kotlin version value into a separate class

In order to selectively ignore it during classpath normalization,
and do not recompile all the dependencies when just the version value
changes.
This commit is contained in:
Ilya Gorbunov
2020-07-09 17:16:45 +03:00
parent cb513b9a70
commit dd47962ad0
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ val writeStdlibVersion by tasks.registering {
inputs.property("version", kotlinVersion)
outputs.file(versionFile)
doLast {
replaceVersion(versionFile, """val CURRENT: KotlinVersion = KotlinVersion\((\d+, \d+, \d+)\)""") {
replaceVersion(versionFile, """fun get\(\): KotlinVersion = KotlinVersion\((\d+, \d+, \d+)\)""") {
val (major, minor, _, optPatch) = Regex("""^(\d+)\.(\d+)(\.(\d+))?""").find(kotlinVersion)?.destructured ?: error("Cannot parse current version $kotlinVersion")
val newVersion = "$major, $minor, ${optPatch.takeIf { it.isNotEmpty() } ?: "0" }"
logger.lifecycle("Writing new standard library version components: $newVersion")