Native: fix support for cross-target filecheck tests

There was a minor mistake in the build script configuration, leading to
a missing task dependency when running the tests with
`-Pkotlin.native.home=`.

More specifically, the build script was checking if the cross-dist for
the main tests target (`-PtestTarget=`) is in place, but instead it
should have checked if the cross-dist for the test cross-target
(`test.targetName`) is in place.

This commit fixes the check, and thus adds the missing task dependency.
This commit is contained in:
Svyatoslav Scherbina
2023-09-07 10:29:16 +02:00
committed by Space Team
parent 5d88a1f1c3
commit f77f83e741
@@ -204,14 +204,13 @@ private val Project.hasPlatformLibs: Boolean
return false
}
private val Project.isCrossDist: Boolean
get() {
if (!isDefaultNativeHome) {
return File(buildDistribution(project.kotlinNativeDist.absolutePath).runtime(project.testTarget))
private fun Project.isCrossDist(target: KonanTarget): Boolean {
if (!isDefaultNativeHome) {
return File(buildDistribution(project.kotlinNativeDist.absolutePath).runtime(target))
.exists()
}
return false
}
return false
}
fun Task.dependsOnDist() {
val target = project.testTarget
@@ -223,7 +222,7 @@ fun Task.dependsOnDist() {
dependsOn(":kotlin-native:${target.name}CrossDist")
}
} else {
if (!project.isCrossDist) {
if (!project.isCrossDist(project.testTarget)) {
dependsOn(":kotlin-native:${target.name}CrossDist")
}
}
@@ -237,7 +236,7 @@ fun Task.dependsOnCrossDist(target: KonanTarget) {
dependsOn(":kotlin-native:${target.name}CrossDist")
}
} else {
if (!project.isCrossDist) {
if (!project.isCrossDist(target)) {
dependsOn(":kotlin-native:${target.name}CrossDist")
}
}