[tests][kotlin-gradle-plugin] workaround for old k/n artifacts
This commit is contained in:
committed by
Stanislav Erokhin
parent
5c80dbfd4b
commit
f051119c4b
+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()
|
||||
|
||||
+33
-33
@@ -56,38 +56,6 @@ class NativeCompilerDownloader(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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?
|
||||
*/
|
||||
private fun CompilerVersion.toStringPre1_5_20(showMeta: Boolean, showBuild: Boolean) = 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)
|
||||
}
|
||||
}
|
||||
|
||||
val versionStringRepresentation = compilerVersion.toStringPre1_5_20(
|
||||
compilerVersion.meta != MetaVersion.RELEASE,
|
||||
compilerVersion.meta != MetaVersion.RELEASE
|
||||
@@ -179,4 +147,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