[build][native] don't ever fix dist, take it with API

This commit is contained in:
Vasily Levchenko
2020-12-16 13:51:12 +01:00
parent ebeac62f17
commit 8a4b5efa9e
16 changed files with 52 additions and 44 deletions
@@ -21,6 +21,7 @@ import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecResult
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.*
import java.nio.file.Paths
import java.util.function.Function
@@ -83,6 +84,7 @@ class RunExternalTestGroup extends JavaExec implements CompilerRunner {
include '*.jar'
}
jvmArgs "-Xmx4G"
jvmArgs "-Dkonan.home=${UtilsKt.getKotlinNativeDist(project)}"
enableAssertions = true
def sources = File.createTempFile(name,".lst")
sources.deleteOnExit()
@@ -35,15 +35,7 @@ fun configureCacheTesting(project: Project): CacheTesting? {
cacheDir.mkdirs()
}
if (!(project.property("useCustomDist") as Boolean)) {
val tasks = listOf(
"${target}CrossDist",
"${target}CrossDistRuntime",
"distCompiler"
).map { task -> project.rootProject.tasks.getByName(task) }
dependsOn(tasks)
}
dependsOnDist()
commandLine(
"$dist/bin/konanc",
@@ -50,10 +50,15 @@ val Project.testOutputFramework
val Project.testOutputExternal
get() = (findProperty("testOutputExternal") as File).toString()
val validPropertiesNames = listOf("kotlin.native.home",
"org.jetbrains.kotlin.native.home",
"konan.home")
val Project.kotlinNativeDist
get() = this.rootProject.file(findProperty("kotlin.native.home")
?: findProperty("org.jetbrains.kotlin.native.home")
?: findProperty("konan.home") ?: "dist")
get() = rootProject.file(validPropertiesNames.firstOrNull{ hasProperty(it) }?.let{ findProperty(it) } ?: "dist")
val kotlinNativeHome
get() = validPropertiesNames.mapNotNull(System::getProperty).first()
val Project.useCustomDist
get() = hasProperty("kotlin.native.home") ||
@@ -132,15 +137,12 @@ fun Project.dependsOnDist(taskName: String) {
}
fun Task.dependsOnDist() {
// We don't build the compiler if a custom dist path is specified.
if (!(project.findProperty("useCustomDist") as Boolean)) {
dependsOn(":kotlin-native:dist")
val target = project.testTarget
if (target != HostManager.host) {
// if a test_target property is set then tests should depend on a crossDist
// otherwise, runtime components would not be build for a target.
dependsOn(":kotlin-native:${target.name}CrossDist")
}
dependsOn(":kotlin-native:dist")
val target = project.testTarget
if (target != HostManager.host) {
// if a test_target property is set then tests should depend on a crossDist
// otherwise, runtime components would not be build for a target.
dependsOn(":kotlin-native:${target.name}CrossDist")
}
}