jps, daemon: pass incremental compilation flag from jps process to daemon
This commit is contained in:
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.config;
|
||||
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class IncrementalCompilation {
|
||||
private static final String INCREMENTAL_COMPILATION_PROPERTY = "kotlin.incremental.compilation";
|
||||
private static final String INCREMENTAL_COMPILATION_JS_PROPERTY = "kotlin.incremental.compilation.js";
|
||||
@@ -39,4 +41,13 @@ public class IncrementalCompilation {
|
||||
public static void setIsEnabledForJs(boolean value) {
|
||||
System.setProperty(INCREMENTAL_COMPILATION_JS_PROPERTY, String.valueOf(value));
|
||||
}
|
||||
|
||||
public static void toJvmArgs(List<String> jvmArgs) {
|
||||
if (isEnabled()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_PROPERTY);
|
||||
if (isEnabledForJs()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_JS_PROPERTY);
|
||||
}
|
||||
|
||||
private static void addJvmSystemFlag(List<String> jvmArgs, String name) {
|
||||
jvmArgs.add("-D" + name + "=true");
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.additionalArgumentsAsList
|
||||
import org.jetbrains.kotlin.daemon.client.CompileServiceSession
|
||||
import org.jetbrains.kotlin.daemon.client.KotlinCompilerClient
|
||||
@@ -318,13 +319,16 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
||||
val toolsJarPath = CompilerRunnerUtil.jdkToolsJar
|
||||
val compilerId = CompilerId.makeCompilerId(listOfNotNull(compilerPath, toolsJarPath))
|
||||
val daemonOptions = configureDaemonOptions()
|
||||
val additionalJvmParams = mutableListOf<String>()
|
||||
|
||||
IncrementalCompilation.toJvmArgs(additionalJvmParams)
|
||||
|
||||
val clientFlagFile = KotlinCompilerClient.getOrCreateClientFlagFile(daemonOptions)
|
||||
val sessionFlagFile = makeAutodeletingFlagFile("compiler-jps-session-", File(daemonOptions.runFilesPathOrDefault))
|
||||
|
||||
environment.withProgressReporter { progress ->
|
||||
progress.progress("connecting to daemon")
|
||||
newDaemonConnection(compilerId, clientFlagFile, sessionFlagFile, environment, daemonOptions)
|
||||
newDaemonConnection(compilerId, clientFlagFile, sessionFlagFile, environment, daemonOptions, additionalJvmParams.toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user