Skip to content

Commit

Permalink
Add KotlinBuilder 'dumb mode' flag
Browse files Browse the repository at this point in the history
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 <aleksei.cherepanov@jetbrains.com>
(cherry picked from commit 3e41faf)
  • Loading branch information
Aleksei.Cherepanov committed Dec 15, 2023
1 parent 712e735 commit 9012e67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -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
Expand Down Expand Up @@ -617,7 +618,7 @@ private fun createMappingsDump(
project: ProjectDescriptor,
kotlinContext: KotlinCompileContext,
lookupsDuringTest: Set<LookupSymbol>,
) = 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)
Expand Down
Expand Up @@ -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 =
Expand Down Expand Up @@ -507,7 +510,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
environment
)

if (!representativeTarget.isIncrementalCompilationEnabled) {
if (isKotlinBuilderInDumbMode || !representativeTarget.isIncrementalCompilationEnabled) {
return OK
}

Expand Down

0 comments on commit 9012e67

Please sign in to comment.