Build: Write plugin version the same way CI does

This commit is contained in:
Vyacheslav Gerasimov
2020-04-06 21:05:21 +03:00
parent 659378f806
commit 1ab23abe93
2 changed files with 8 additions and 1 deletions
@@ -30,6 +30,8 @@ enum class Platform : CompatibilityPredicate {
val version: Int = name.drop(1).toInt()
val displayVersion: String = "20${name.drop(1).dropLast(1)}.${name.last()}"
override fun matches(ide: Ide) = ide.platform == this
companion object {
@@ -53,6 +55,11 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
val kind = Kind.values().first { it.shortName == name.take(2) }
val version = name.dropWhile { !it.isDigit() }.toInt()
val displayVersion: String = when (kind) {
Kind.IntelliJ -> "IJ${platform.displayVersion}"
Kind.AndroidStudio -> "Studio${name.substringAfter("AS").toCharArray().joinToString(separator = ".")}"
}
override fun matches(ide: Ide) = ide == this
enum class Kind(val shortName: String) {
+1 -1
View File
@@ -187,7 +187,7 @@ 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 defaultPluginVersion = "$kotlinVersion-${currentIde.displayVersion}-$pluginPatchNumber"
val pluginVersion = findProperty("pluginVersion") as String? ?: defaultPluginVersion
inputs.property("pluginVersion", pluginVersion)