Revert "[K/N][gradle] Automatic cleaning of the class loaders map"

This reverts commit 874b442a13.
This commit is contained in:
Igor Chevdar
2021-11-26 14:00:30 +05:00
parent 2b84e8e68f
commit 031d92e21f
2 changed files with 2 additions and 16 deletions
-4
View File
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.CompareDistributionSignatures
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.kotlin.UtilsKt
import java.util.concurrent.ConcurrentHashMap
buildscript {
apply from: "gradle/kotlinGradlePlugin.gradle"
@@ -96,9 +95,6 @@ ext {
konanVersionFull = ext.kotlinNativeVersion
gradlePluginVersion = konanVersionFull
// A separate map for each build for automatic cleaning the daemon after the build have finished.
toolClassLoadersMap = new ConcurrentHashMap<Object, URLClassLoader>()
}
allprojects {
@@ -28,8 +28,6 @@ import java.io.File
import java.util.Properties
import org.jetbrains.kotlin.compilerRunner.KotlinToolRunner
import org.jetbrains.kotlin.konan.target.AbstractToolConfig
import java.net.URLClassLoader
import java.util.concurrent.ConcurrentHashMap
internal interface KonanToolRunner {
fun run(args: List<String>)
@@ -70,15 +68,10 @@ internal abstract class KonanCliRunner(
""".trimIndent()
}
data class IsolatedClassLoaderCacheKey(val classpath: Set<File>)
data class IsolatedClassLoaderCacheKey(val classpath: Set<java.io.File>, val project: Project)
// TODO: can't we use this for other implementations too?
final override val isolatedClassLoaderCacheKey get() = IsolatedClassLoaderCacheKey(classpath)
// A separate map for each build for automatic cleaning the daemon after the build have finished.
@Suppress("UNCHECKED_CAST")
final override val isolatedClassLoaders get() =
project.project(":kotlin-native").ext["toolClassLoadersMap"] as ConcurrentHashMap<Any, URLClassLoader>
final override val isolatedClassLoaderCacheKey get() = IsolatedClassLoaderCacheKey(classpath, project)
override fun transformArgs(args: List<String>) = listOf(toolName) + args
@@ -117,9 +110,6 @@ private val load0 = Runtime::class.java.getDeclaredMethod("load0", Class::class.
internal class CliToolConfig(konanHome: String, target: String) : AbstractToolConfig(konanHome, target, emptyMap()) {
override fun loadLibclang() {
// Load libclang into the system class loader. This is needed to allow developers to make changes
// in the tooling infrastructure without having to stop the daemon (otherwise libclang might end up
// loaded in two different class loaders which is not allowed by the JVM).
load0.invoke(Runtime.getRuntime(), String::class.java, libclang)
}
}