[gradle] Added option to customize class loaders map
This will be used in the K/N build for automatic cleaning of the daemon
This commit is contained in:
+3
-1
@@ -38,7 +38,9 @@ abstract class KotlinToolRunner(
|
|||||||
open fun checkClasspath(): Unit = check(classpath.isNotEmpty()) { "Classpath of the tool is empty: $displayName" }
|
open fun checkClasspath(): Unit = check(classpath.isNotEmpty()) { "Classpath of the tool is empty: $displayName" }
|
||||||
|
|
||||||
abstract val isolatedClassLoaderCacheKey: Any
|
abstract val isolatedClassLoaderCacheKey: Any
|
||||||
private fun getIsolatedClassLoader(): URLClassLoader = isolatedClassLoadersMap.computeIfAbsent(isolatedClassLoaderCacheKey) {
|
protected open val isolatedClassLoaders: ConcurrentHashMap<Any, URLClassLoader> get() = isolatedClassLoadersMap
|
||||||
|
|
||||||
|
private fun getIsolatedClassLoader(): URLClassLoader = isolatedClassLoaders.computeIfAbsent(isolatedClassLoaderCacheKey) {
|
||||||
val arrayOfURLs = classpath.map { File(it.absolutePath).toURI().toURL() }.toTypedArray()
|
val arrayOfURLs = classpath.map { File(it.absolutePath).toURI().toURL() }.toTypedArray()
|
||||||
URLClassLoader(arrayOfURLs, null).apply {
|
URLClassLoader(arrayOfURLs, null).apply {
|
||||||
setDefaultAssertionStatus(enableAssertions)
|
setDefaultAssertionStatus(enableAssertions)
|
||||||
|
|||||||
Reference in New Issue
Block a user