From 9012e67fdb2810380590b03e1a6e0893aedce7b2 Mon Sep 17 00:00:00 2001 From: "Aleksei.Cherepanov" Date: Fri, 15 Dec 2023 00:20:54 +0000 Subject: [PATCH] Add KotlinBuilder 'dumb mode' flag A new system property was added to enable a 'dumb mode' for KotlinBuilder. In this mode it is possible to disable IC caches, but don't request rebuild And all IC trackers will still work ^KT-64305 Fixed Merge-request: KT-MR-13524 Merged-by: Aleksei Cherepanov (cherry picked from commit 3e41faf91f7c51936b24e5014f87fbafd7328656) --- .../jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt | 3 ++- .../src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 3db5d69713515..e96a408c4b5aa 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 @@ -39,6 +39,7 @@ import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments import org.jetbrains.kotlin.incremental.LookupSymbol import org.jetbrains.kotlin.incremental.testingUtils.* import org.jetbrains.kotlin.incremental.utils.TestLookupTracker +import org.jetbrains.kotlin.jps.build.KotlinBuilder.Companion.useDependencyGraph import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxt import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxtBuilder import org.jetbrains.kotlin.jps.build.fixtures.EnableICFixture @@ -617,7 +618,7 @@ private fun createMappingsDump( project: ProjectDescriptor, kotlinContext: KotlinCompileContext, lookupsDuringTest: Set, -) = if (System.getProperty("jps.use.dependency.graph", "false").toBoolean()) "" else +) = if (useDependencyGraph) "" else createKotlinCachesDump(project, kotlinContext, lookupsDuringTest) + "\n\n\n" + createCommonMappingsDump(project) + "\n\n\n" + createJavaMappingsDump(project) 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 f080cab9939d5..9704d74ba1fea 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 @@ -62,6 +62,9 @@ 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" + val useDependencyGraph = System.getProperty("jps.use.dependency.graph", "false")!!.toBoolean() + val isKotlinBuilderInDumbMode = System.getProperty("kotlin.jps.dumb.mode", "false")!!.toBoolean() + private val classesToLoadByParentFromRegistry = System.getProperty("kotlin.jps.classesToLoadByParent")?.split(',')?.map { it.trim() } ?: emptyList() private val classPrefixesToLoadByParentFromRegistry = @@ -507,7 +510,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { environment ) - if (!representativeTarget.isIncrementalCompilationEnabled) { + if (isKotlinBuilderInDumbMode || !representativeTarget.isIncrementalCompilationEnabled) { return OK }