Build: Write plugin version the same way CI does
This commit is contained in:
@@ -30,6 +30,8 @@ enum class Platform : CompatibilityPredicate {
|
|||||||
|
|
||||||
val version: Int = name.drop(1).toInt()
|
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
|
override fun matches(ide: Ide) = ide.platform == this
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -53,6 +55,11 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
|
|||||||
val kind = Kind.values().first { it.shortName == name.take(2) }
|
val kind = Kind.values().first { it.shortName == name.take(2) }
|
||||||
val version = name.dropWhile { !it.isDigit() }.toInt()
|
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
|
override fun matches(ide: Ide) = ide == this
|
||||||
|
|
||||||
enum class Kind(val shortName: String) {
|
enum class Kind(val shortName: String) {
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ dependencies {
|
|||||||
tasks.named<Copy>("processResources") {
|
tasks.named<Copy>("processResources") {
|
||||||
val currentIde = IdeVersionConfigurator.currentIde
|
val currentIde = IdeVersionConfigurator.currentIde
|
||||||
val pluginPatchNumber = findProperty("pluginPatchNumber") as String? ?: "1"
|
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
|
val pluginVersion = findProperty("pluginVersion") as String? ?: defaultPluginVersion
|
||||||
|
|
||||||
inputs.property("pluginVersion", pluginVersion)
|
inputs.property("pluginVersion", pluginVersion)
|
||||||
|
|||||||
Reference in New Issue
Block a user