diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index ee8f831d880..3574f8e9df4 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -15,6 +15,7 @@ */ package org.jetbrains.kotlin.jps.build + import com.intellij.openapi.Disposable import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil @@ -101,6 +102,7 @@ abstract class AbstractIncrementalJpsTest( protected lateinit var workDir: File protected lateinit var projectDescriptor: ProjectDescriptor protected lateinit var additionalCommandLineArguments: List + // is used to compare lookup dumps in a human readable way (lookup symbols are hashed in an actual lookup storage) protected lateinit var lookupsDuringTest: MutableSet private var isJvmICEnabledBackup: Boolean = false @@ -150,6 +152,8 @@ abstract class AbstractIncrementalJpsTest( if (DEBUG_LOGGING_ENABLED) { enableDebugLogging() } + System.getProperties() + .setProperty("kotlin.jps.classPrefixesToLoadByParent", "kotlin.") // for debugging tests with in-process compiler } override fun tearDown() { @@ -402,7 +406,7 @@ abstract class AbstractIncrementalJpsTest( // null means one module private fun configureModules(): ModulesTxt? { JpsJavaExtensionService.getInstance().getOrCreateProjectExtension(myProject).outputUrl = - JpsPathUtil.pathToUrl(getAbsolutePath("out")) + JpsPathUtil.pathToUrl(getAbsolutePath("out")) val jdk = addJdk("my jdk") val modulesTxt = readModulesTxt() diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index ee26bf8d919..3c3e8399041 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -71,17 +71,32 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { const val SKIP_CACHE_VERSION_CHECK_PROPERTY = "kotlin.jps.skip.cache.version.check" const val JPS_KOTLIN_HOME_PROPERTY = "jps.kotlin.home" + private val classesToLoadByParentFromRegistry = + System.getProperty("kotlin.jps.classesToLoadByParent")?.split(',')?.map { it.trim() } ?: emptyList() + private val classPrefixesToLoadByParentFromRegistry = + System.getProperty("kotlin.jps.classPrefixesToLoadByParent")?.split(',')?.map { it.trim() } ?: emptyList() + val classesToLoadByParent: ClassCondition get() = ClassCondition { className -> - className.startsWith("org.jetbrains.kotlin.load.kotlin.incremental.components.") - || className.startsWith("org.jetbrains.kotlin.incremental.components.") - || className.startsWith("org.jetbrains.kotlin.incremental.js") - || className == "org.jetbrains.kotlin.config.Services" - || className.startsWith("org.apache.log4j.") // For logging from compiler - || className == "org.jetbrains.kotlin.progress.CompilationCanceledStatus" - || className == "org.jetbrains.kotlin.progress.CompilationCanceledException" - || className == "org.jetbrains.kotlin.modules.TargetId" - || className == "org.jetbrains.kotlin.cli.common.ExitCode" + val prefixes = listOf( + "org.apache.log4j.", // For logging from compiler + "org.jetbrains.kotlin.incremental.components.", + "org.jetbrains.kotlin.incremental.js", + "org.jetbrains.kotlin.load.kotlin.incremental.components." + ) + classPrefixesToLoadByParentFromRegistry + + val classes = listOf( + "org.jetbrains.kotlin.config.Services", + "org.jetbrains.kotlin.progress.CompilationCanceledStatus", + "org.jetbrains.kotlin.progress.CompilationCanceledException", + "org.jetbrains.kotlin.modules.TargetId", + "org.jetbrains.kotlin.cli.common.ExitCode" + ) + classesToLoadByParentFromRegistry + + prefixes.forEach { if (className.startsWith(it)) return@ClassCondition true } + classes.forEach { if (className == it) return@ClassCondition true } + + return@ClassCondition false } }