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:
@@ -66,6 +66,7 @@ import java.util.stream.Collectors;
|
||||
import static org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR;
|
||||
import static org.jetbrains.kotlin.cli.common.ExitCode.OK;
|
||||
import static org.jetbrains.kotlin.cli.common.UtilsKt.getLibraryFromHome;
|
||||
import static org.jetbrains.kotlin.cli.common.UtilsKt.incrementalCompilationIsEnabledForJs;
|
||||
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*;
|
||||
|
||||
public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
@@ -181,7 +182,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
if (arguments.getFreeArgs().isEmpty() && !IncrementalCompilation.isEnabledForJs()) {
|
||||
if (arguments.getFreeArgs().isEmpty() && (!incrementalCompilationIsEnabledForJs(arguments))) {
|
||||
if (arguments.getVersion()) {
|
||||
return OK;
|
||||
}
|
||||
@@ -219,7 +220,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
return ExitCode.COMPILATION_ERROR;
|
||||
}
|
||||
|
||||
if (sourcesFiles.isEmpty() && !IncrementalCompilation.isEnabledForJs()) {
|
||||
if (sourcesFiles.isEmpty() && !incrementalCompilationIsEnabledForJs(arguments)) {
|
||||
messageCollector.report(ERROR, "No source files", null);
|
||||
return COMPILATION_ERROR;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
return scriptingEvaluator.eval(arguments, configuration, projectEnv)
|
||||
}
|
||||
|
||||
if (arguments.freeArgs.isEmpty() && !IncrementalCompilation.isEnabledForJs()) {
|
||||
if (arguments.freeArgs.isEmpty() && !(incrementalCompilationIsEnabledForJs(arguments))) {
|
||||
if (arguments.version) {
|
||||
return OK
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
return ExitCode.COMPILATION_ERROR
|
||||
}
|
||||
|
||||
if (sourcesFiles.isEmpty() && !IncrementalCompilation.isEnabledForJs() && arguments.includes.isNullOrEmpty()) {
|
||||
if (sourcesFiles.isEmpty() && (!incrementalCompilationIsEnabledForJs(arguments)) && arguments.includes.isNullOrEmpty()) {
|
||||
messageCollector.report(ERROR, "No source files", null)
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user