From ac0dc94800191eeffc6bd67e11ebb2ffc37126ec Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Wed, 2 Jun 2021 18:11:57 +0300 Subject: [PATCH] Since 1.5.30-dev-1466 a new archive naming schema was introduced Support both names in NativeCompilerDownloader --- .../targets/native/NativeCompilerDownloader.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/NativeCompilerDownloader.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/NativeCompilerDownloader.kt index 5cd9cf3a2ee..cbd9383cba6 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/NativeCompilerDownloader.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/NativeCompilerDownloader.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.gradle.logging.kotlinInfo import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionType import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionTypeProvider import org.jetbrains.kotlin.konan.CompilerVersion +import org.jetbrains.kotlin.konan.CompilerVersionImpl import org.jetbrains.kotlin.konan.MetaVersion import org.jetbrains.kotlin.konan.target.HostManager import org.jetbrains.kotlin.konan.util.DependencyDirectories @@ -45,7 +46,20 @@ class NativeCompilerDownloader( get() = NativeDistributionTypeProvider(project).getDistributionType(compilerVersion) private val simpleOsName: String - get() = HostManager.platformName() + get() { + fun CompilerVersion.isAtLeast(compilerVersion: CompilerVersion): Boolean { + if (this.major != compilerVersion.major) return this.major > compilerVersion.major + if (this.minor != compilerVersion.minor) return this.minor > compilerVersion.minor + if (this.maintenance != compilerVersion.maintenance) return this.maintenance > compilerVersion.maintenance + if (this.meta.ordinal != compilerVersion.meta.ordinal) return this.meta.ordinal > compilerVersion.meta.ordinal + return this.build >= compilerVersion.build + } + return if (compilerVersion.isAtLeast(CompilerVersionImpl(major = 1, minor = 5, maintenance = 30, build = 1466))) { + HostManager.platformName() + } else { + HostManager.simpleOsName() + } + } private val dependencyName: String get() {