Fix IC with daemon

JPS IC with daemon was not working since
the commit 514635e965

Before that change `IncrementalCompilation.isEnabled`
returned `true` when the corresponding system property was not set.
After the change `isEnabled` returns `true` only if
the system property is set and equals to `"true"`.

The property was never set up for the daemon if `CompilerMode.JPS_COMPILER`
was used (the property was set up in a JPS process or in the daemon in case
it was used with Gradle).

     #KT-19414 fixed
This commit is contained in:
Alexey Tsvetkov
2017-08-02 22:49:20 +03:00
parent 82c62b4d8e
commit f0becd0040
2 changed files with 7 additions and 5 deletions
@@ -376,9 +376,11 @@ class CompileServiceImpl(
CompilerMode.JPS_COMPILER -> { CompilerMode.JPS_COMPILER -> {
val jpsServicesFacade = servicesFacade as JpsCompilerServicesFacade val jpsServicesFacade = servicesFacade as JpsCompilerServicesFacade
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> withIC(enabled = servicesFacade.hasIncrementalCaches()) {
val services = createCompileServices(jpsServicesFacade, eventManger, profiler) doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
compiler.exec(messageCollector, services, k2PlatformArgs) val services = createCompileServices(jpsServicesFacade, eventManger, profiler)
compiler.exec(messageCollector, services, k2PlatformArgs)
}
} }
} }
CompilerMode.NON_INCREMENTAL_COMPILER -> { CompilerMode.NON_INCREMENTAL_COMPILER -> {
@@ -71,9 +71,9 @@ private object EmptyICReporter : ICReporter {
} }
} }
inline fun <R> withIC(fn: ()->R): R { inline fun <R> withIC(enabled: Boolean = true, fn: ()->R): R {
val isEnabledBackup = IncrementalCompilation.isEnabled() val isEnabledBackup = IncrementalCompilation.isEnabled()
IncrementalCompilation.setIsEnabled(true) IncrementalCompilation.setIsEnabled(enabled)
try { try {
return fn() return fn()