Don't use global state for keeping incremental compilation state

Previously IC state was stored in System properties. As result parallel
compilation might cause incorrect state of IC, what led to corruption
of kotlin_module files. Now IC state is stored via CompilerArguments
and CompilerConfiguration
#KT-46038 Fixed
This commit is contained in:
Andrey Uskov
2021-09-20 21:17:18 +03:00
committed by teamcity
parent 99300bd885
commit 2adc851f1b
21 changed files with 98 additions and 32 deletions
@@ -25,23 +25,26 @@ public class IncrementalCompilation {
public static final String INCREMENTAL_COMPILATION_JS_PROPERTY = "kotlin.incremental.compilation.js";
public static boolean isEnabledForJvm() {
return "true".equals(System.getProperty(INCREMENTAL_COMPILATION_JVM_PROPERTY));
return Boolean.valueOf(System.getProperty(INCREMENTAL_COMPILATION_JVM_PROPERTY));
}
public static boolean isEnabledForJs() {
return "true".equals(System.getProperty(INCREMENTAL_COMPILATION_JS_PROPERTY));
return Boolean.valueOf(System.getProperty(INCREMENTAL_COMPILATION_JS_PROPERTY));
}
@Deprecated
@TestOnly
public static void setIsEnabledForJvm(boolean value) {
System.setProperty(INCREMENTAL_COMPILATION_JVM_PROPERTY, String.valueOf(value));
}
@Deprecated
@TestOnly
public static void setIsEnabledForJs(boolean value) {
System.setProperty(INCREMENTAL_COMPILATION_JS_PROPERTY, String.valueOf(value));
}
@Deprecated
public static void toJvmArgs(List<String> jvmArgs) {
if (isEnabledForJvm()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_JVM_PROPERTY);
if (isEnabledForJs()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_JS_PROPERTY);