Minor: fix JetCoreEnvironment#(createForProduction, createForTests) call sites for JVM.
This commit is contained in:
@@ -26,10 +26,7 @@ import org.jetbrains.jet.cli.common.ExitCode;
|
||||
import org.jetbrains.jet.cli.common.arguments.K2JVMCompilerArguments;
|
||||
import org.jetbrains.jet.cli.common.messages.*;
|
||||
import org.jetbrains.jet.cli.common.modules.ModuleScriptData;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CommandLineScriptUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentUtil;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.*;
|
||||
import org.jetbrains.jet.cli.jvm.repl.ReplFromTerminal;
|
||||
import org.jetbrains.jet.codegen.CompilationException;
|
||||
import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
@@ -73,7 +70,7 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector);
|
||||
|
||||
IncrementalCacheProvider incrementalCacheProvider = (IncrementalCacheProvider) services.get(IncrementalCacheProvider.class);
|
||||
IncrementalCacheProvider incrementalCacheProvider = services.get(IncrementalCacheProvider.class);
|
||||
if (incrementalCacheProvider != null) {
|
||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_CACHE_PROVIDER, incrementalCacheProvider);
|
||||
}
|
||||
@@ -152,11 +149,13 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
}
|
||||
else if (arguments.script) {
|
||||
List<String> scriptArgs = arguments.freeArgs.subList(1, arguments.freeArgs.size());
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
|
||||
JetCoreEnvironment environment =
|
||||
JetCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
KotlinToJVMBytecodeCompiler.compileAndExecuteScript(paths, environment, scriptArgs);
|
||||
}
|
||||
else {
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
|
||||
JetCoreEnvironment environment =
|
||||
JetCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment, jar, outputDir, arguments.includeRuntime);
|
||||
}
|
||||
return OK;
|
||||
|
||||
@@ -116,7 +116,8 @@ public class CompileEnvironmentUtil {
|
||||
|
||||
Disposable disposable = Disposer.newDisposable();
|
||||
try {
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createForProduction(disposable, configuration);
|
||||
JetCoreEnvironment scriptEnvironment =
|
||||
JetCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment);
|
||||
if (generationState == null) {
|
||||
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " analyze failed:\n" +
|
||||
|
||||
@@ -78,14 +78,6 @@ public class JetCoreEnvironment {
|
||||
private static JavaCoreApplicationEnvironment ourApplicationEnvironment;
|
||||
private static int ourProjectCount = 0;
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createForProduction(
|
||||
@NotNull Disposable parentDisposable,
|
||||
@NotNull CompilerConfiguration configuration
|
||||
) {
|
||||
return createForProduction(parentDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createForProduction(
|
||||
@NotNull Disposable parentDisposable,
|
||||
@@ -113,15 +105,6 @@ public class JetCoreEnvironment {
|
||||
return environment;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createForTests(
|
||||
@NotNull Disposable parentDisposable,
|
||||
@NotNull CompilerConfiguration configuration
|
||||
) {
|
||||
return createForTests(parentDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createForTests(
|
||||
|
||||
+2
-1
@@ -117,7 +117,8 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
Disposable parentDisposable = Disposer.newDisposable();
|
||||
JetCoreEnvironment environment = null;
|
||||
try {
|
||||
environment = JetCoreEnvironment.createForProduction(parentDisposable, compilerConfiguration);
|
||||
environment = JetCoreEnvironment
|
||||
.createForProduction(parentDisposable, compilerConfiguration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
AnalysisResult result = analyze(environment);
|
||||
if (result == null) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.jetbrains.jet.cli.common.messages.AnalyzerWithCompilerReport;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollectorToString;
|
||||
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CliLightClassGenerationSupport;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.codegen.ClassBuilderFactories;
|
||||
@@ -101,7 +102,8 @@ public class ReplInterpreter {
|
||||
private final ScriptMutableDeclarationProviderFactory scriptDeclarationFactory;
|
||||
|
||||
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(disposable, configuration);
|
||||
JetCoreEnvironment environment =
|
||||
JetCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
Project project = environment.getProject();
|
||||
this.psiFileFactory = (PsiFileFactoryImpl) PsiFileFactory.getInstance(project);
|
||||
this.trace = new CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace();
|
||||
|
||||
Reference in New Issue
Block a user