[Gradle] Fix switching in-process to Native embeddable compiler jar
Compiler runner used incorrect cache key for isolated classloader: it didn't take the actually used compiler jar into account, only the K/N home dir. Fix this by using the entire classpath as a key.
This commit is contained in:
committed by
Space
parent
1c052ad448
commit
e65f2e465e
+21
@@ -55,4 +55,25 @@ class NativeEmbeddableCompilerJarIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSwitch() = with(transformNativeTestProjectWithPluginDsl("executables", directoryPrefix = "native-binaries")) {
|
||||
build(":runDebugExecutableHost") {
|
||||
assertSuccessful()
|
||||
checkNativeCompilerClasspath(":linkDebugExecutableHost", ":compileKotlinHost") {
|
||||
assertTrue(it.includesRegularJar())
|
||||
assertFalse(it.includesEmbeddableJar())
|
||||
}
|
||||
}
|
||||
|
||||
build(":clean") {} // Ensure the tasks aren't up-to-date.
|
||||
|
||||
build(":runDebugExecutableHost", "-Pkotlin.native.useEmbeddableCompilerJar=true") {
|
||||
assertSuccessful()
|
||||
checkNativeCompilerClasspath(":linkDebugExecutableHost", ":compileKotlinHost") {
|
||||
assertFalse(it.includesRegularJar())
|
||||
assertTrue(it.includesEmbeddableJar())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -99,7 +99,10 @@ internal abstract class KotlinNativeToolRunner(
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
final override val isolatedClassLoaderCacheKey get() = project.konanHome
|
||||
data class IsolatedClassLoaderCacheKey(val classpath: Set<java.io.File>)
|
||||
|
||||
// TODO: can't we use this for other implementations too?
|
||||
final override val isolatedClassLoaderCacheKey get() = IsolatedClassLoaderCacheKey(classpath)
|
||||
|
||||
override fun transformArgs(args: List<String>) = listOf(toolName) + args
|
||||
|
||||
|
||||
Reference in New Issue
Block a user