Reading KOTLIN_HOME only once

may fix #KT-21145, or at least make it less flaky
This commit is contained in:
Ilya Chernikov
2017-12-13 15:58:53 +01:00
parent 945da50b61
commit efc470df2b
@@ -44,6 +44,7 @@ import java.io.PrintStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.jetbrains.kotlin.cli.common.ExitCode.*; import static org.jetbrains.kotlin.cli.common.ExitCode.*;
import static org.jetbrains.kotlin.cli.common.environment.UtilKt.setIdeaIoUseFallback; import static org.jetbrains.kotlin.cli.common.environment.UtilKt.setIdeaIoUseFallback;
@@ -239,11 +240,12 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
// do nothing // do nothing
} }
private static final String kotlinHomeEnvVar = System.getenv(KOTLIN_HOME_ENV_VAR);
@Nullable @Nullable
private static KotlinPaths computeKotlinPaths(@NotNull MessageCollector messageCollector, @NotNull CommonCompilerArguments arguments) { private static KotlinPaths computeKotlinPaths(@NotNull MessageCollector messageCollector, @NotNull CommonCompilerArguments arguments) {
KotlinPaths paths; KotlinPaths paths;
String kotlinHomeProperty = System.getProperty(KOTLIN_HOME_PROPERTY); String kotlinHomeProperty = System.getProperty(KOTLIN_HOME_PROPERTY);
String kotlinHomeEnvVar = System.getenv(KOTLIN_HOME_ENV_VAR);
File kotlinHome = File kotlinHome =
arguments.getKotlinHome() != null ? new File(arguments.getKotlinHome()) : arguments.getKotlinHome() != null ? new File(arguments.getKotlinHome()) :
kotlinHomeProperty != null ? new File(kotlinHomeProperty) : kotlinHomeProperty != null ? new File(kotlinHomeProperty) :