From 1ab23abe9354c0d025d1ec660b904178dc02cd09 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 6 Apr 2020 21:05:21 +0300 Subject: [PATCH] Build: Write plugin version the same way CI does --- buildSrc/src/main/kotlin/IdeCompatibilityDsl.kt | 7 +++++++ idea/build.gradle.kts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/IdeCompatibilityDsl.kt b/buildSrc/src/main/kotlin/IdeCompatibilityDsl.kt index 2b19575f0d8..1191b51450d 100644 --- a/buildSrc/src/main/kotlin/IdeCompatibilityDsl.kt +++ b/buildSrc/src/main/kotlin/IdeCompatibilityDsl.kt @@ -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) { diff --git a/idea/build.gradle.kts b/idea/build.gradle.kts index 87d07ccc353..732eb23dc72 100644 --- a/idea/build.gradle.kts +++ b/idea/build.gradle.kts @@ -187,7 +187,7 @@ dependencies { tasks.named("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)