[MERGE] Kotlin/Native history merged into kotlin/master

This commit is contained in:
Stanislav Erokhin
2021-02-26 15:30:58 +01:00
3031 changed files with 282024 additions and 32 deletions
@@ -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)
}
}