[MERGE] Kotlin/Native history merged into kotlin/master
This commit is contained in:
+2
-1
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.native.GeneralNativeIT.Companion.extractNativ
|
||||
import org.jetbrains.kotlin.gradle.transformProjectWithPluginsDsl
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
||||
import org.jetbrains.kotlin.gradle.utils.toStringPre1_5_20
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.presetName
|
||||
@@ -54,7 +55,7 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
||||
// Clean existing installation directories.
|
||||
val osName = HostManager.simpleOsName()
|
||||
val oldCompilerDir = DependencyDirectories.localKonanDir.resolve("kotlin-native-$osName-$oldCompilerVersion")
|
||||
val currentCompilerDir = DependencyDirectories.localKonanDir.resolve("kotlin-native-$osName-$currentCompilerVersion")
|
||||
val currentCompilerDir = DependencyDirectories.localKonanDir.resolve("kotlin-native-$osName-${currentCompilerVersion.toStringPre1_5_20()}")
|
||||
|
||||
for (compilerDirectory in listOf(oldCompilerDir, currentCompilerDir)) {
|
||||
compilerDirectory.deleteRecursively()
|
||||
|
||||
+42
-4
@@ -57,8 +57,14 @@ class NativeCompilerDownloader(
|
||||
}
|
||||
}
|
||||
|
||||
val versionStringRepresentation = compilerVersion.toStringPre1_5_20(
|
||||
compilerVersion.meta != MetaVersion.RELEASE,
|
||||
compilerVersion.meta != MetaVersion.RELEASE
|
||||
)
|
||||
|
||||
|
||||
private val dependencyNameWithVersion: String
|
||||
get() = "$dependencyName-$compilerVersion"
|
||||
get() = "$dependencyName-$versionStringRepresentation"
|
||||
|
||||
private val dependencyFileName: String
|
||||
get() = "$dependencyNameWithVersion.$archiveExtension"
|
||||
@@ -100,7 +106,7 @@ class NativeCompilerDownloader(
|
||||
val repoUrl = buildString {
|
||||
append("$BASE_DOWNLOAD_URL/")
|
||||
append(if (compilerVersion.meta == MetaVersion.DEV) "dev/" else "releases/")
|
||||
append("$compilerVersion/")
|
||||
append("$versionStringRepresentation/")
|
||||
append(simpleOsName)
|
||||
}
|
||||
val dependencyUrl = "$repoUrl/$dependencyFileName"
|
||||
@@ -110,7 +116,7 @@ class NativeCompilerDownloader(
|
||||
val compilerDependency = project.dependencies.create(
|
||||
mapOf(
|
||||
"name" to dependencyName,
|
||||
"version" to compilerVersion.toString(),
|
||||
"version" to versionStringRepresentation,
|
||||
"ext" to archiveExtension
|
||||
)
|
||||
)
|
||||
@@ -157,4 +163,36 @@ class NativeCompilerDownloader(
|
||||
downloadAndExtract()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Once we've decide to make K/N version like K one (with droppable maintenance 0), but this breaks old publications,
|
||||
* when did merging kotlin with kotlin/native after 1.5.0 release.
|
||||
* older 1.5.20?
|
||||
*/
|
||||
fun CompilerVersion.toStringPre1_5_20(showMeta: Boolean = meta != MetaVersion.RELEASE, showBuild: Boolean = meta != MetaVersion.RELEASE) =
|
||||
buildString {
|
||||
if (major > 1
|
||||
|| minor > 5
|
||||
|| maintenance > 20
|
||||
)
|
||||
return toString(showMeta, showBuild)
|
||||
append(major)
|
||||
append('.')
|
||||
append(minor)
|
||||
if (maintenance != 0) {
|
||||
append('.')
|
||||
append(maintenance)
|
||||
}
|
||||
if (milestone != -1) {
|
||||
append("-M")
|
||||
append(milestone)
|
||||
}
|
||||
if (showMeta) {
|
||||
append('-')
|
||||
append(meta.metaString)
|
||||
}
|
||||
if (showBuild && build != -1) {
|
||||
append('-')
|
||||
append(build)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user