[commonizer-api] workaround for old k/n artifacts
This commit is contained in:
committed by
Stanislav Erokhin
parent
e123127a4a
commit
b05e742238
@@ -1,5 +1,18 @@
|
|||||||
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
import org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() ?: false
|
||||||
|
dependencies {
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
if (cacheRedirectorEnabled)
|
||||||
|
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||||
|
else
|
||||||
|
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
@@ -26,17 +39,54 @@ sourceSets {
|
|||||||
"test" { projectDefault() }
|
"test" { projectDefault() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: This version hack on migrating period K/N into repository Kotlin, in new build infrostructure zero maintance claus isn't dropped,
|
||||||
|
* so for old builds we need to keep this version to string representation till total switch on new infrostructure.
|
||||||
|
*/
|
||||||
|
val konanVersion = object: org.jetbrains.kotlin.konan.CompilerVersion by NativeCompilerDownloader.DEFAULT_KONAN_VERSION {
|
||||||
|
override fun toString(showMeta: Boolean, showBuild: Boolean) = buildString {
|
||||||
|
if (major > 1
|
||||||
|
|| minor > 5
|
||||||
|
|| maintenance > 20
|
||||||
|
)
|
||||||
|
return NativeCompilerDownloader.DEFAULT_KONAN_VERSION.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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString() = toString(meta != org.jetbrains.kotlin.konan.MetaVersion.RELEASE,
|
||||||
|
meta != org.jetbrains.kotlin.konan.MetaVersion.RELEASE)
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register("downloadNativeCompiler") {
|
tasks.register("downloadNativeCompiler") {
|
||||||
doFirst {
|
doFirst {
|
||||||
NativeCompilerDownloader(project).downloadIfNeeded()
|
NativeCompilerDownloader(project, konanVersion).downloadIfNeeded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
projectTest(parallel = false) {
|
projectTest(parallel = false) {
|
||||||
dependsOn(":dist")
|
dependsOn(":dist")
|
||||||
dependsOn("downloadNativeCompiler")
|
dependsOn("downloadNativeCompiler")
|
||||||
workingDir = projectDir
|
workingDir = projectDir
|
||||||
environment("KONAN_HOME", NativeCompilerDownloader(project).compilerDirectory.absolutePath)
|
environment("KONAN_HOME", NativeCompilerDownloader(project, konanVersion).compilerDirectory.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeJar()
|
runtimeJar()
|
||||||
|
|||||||
Reference in New Issue
Block a user