[K/N][build] Define meta versions order and comparing
Move isAtLeast() from compiler downloader and test to CompilerVersion.kt
This commit is contained in:
+1
-8
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.CompilerVersionImpl
|
||||
import org.jetbrains.kotlin.konan.isAtLeast
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.presetName
|
||||
@@ -65,14 +66,6 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
private 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
|
||||
}
|
||||
|
||||
private fun simpleOsName(compilerVersion: CompilerVersion): String =
|
||||
if (compilerVersion.isAtLeast(CompilerVersionImpl(major = 1, minor = 5, maintenance = 30, build = 1466))) {
|
||||
HostManager.platformName()
|
||||
|
||||
+1
-7
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionTyp
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.CompilerVersionImpl
|
||||
import org.jetbrains.kotlin.konan.MetaVersion
|
||||
import org.jetbrains.kotlin.konan.isAtLeast
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
||||
import java.io.File
|
||||
@@ -50,13 +51,6 @@ class NativeCompilerDownloader(
|
||||
|
||||
private val simpleOsName: String
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user