diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt index 1625dcb16b4..643148e970d 100644 --- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt +++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt @@ -376,9 +376,11 @@ class CompileServiceImpl( CompilerMode.JPS_COMPILER -> { val jpsServicesFacade = servicesFacade as JpsCompilerServicesFacade - doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> - val services = createCompileServices(jpsServicesFacade, eventManger, profiler) - compiler.exec(messageCollector, services, k2PlatformArgs) + withIC(enabled = servicesFacade.hasIncrementalCaches()) { + doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> + val services = createCompileServices(jpsServicesFacade, eventManger, profiler) + compiler.exec(messageCollector, services, k2PlatformArgs) + } } } CompilerMode.NON_INCREMENTAL_COMPILER -> { diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt index d6ac3752148..ffd9890af13 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt @@ -71,9 +71,9 @@ private object EmptyICReporter : ICReporter { } } -inline fun withIC(fn: ()->R): R { +inline fun withIC(enabled: Boolean = true, fn: ()->R): R { val isEnabledBackup = IncrementalCompilation.isEnabled() - IncrementalCompilation.setIsEnabled(true) + IncrementalCompilation.setIsEnabled(enabled) try { return fn()