Rename JetCoreEnvironment -> KotlinCoreEnvironemnt

This commit is contained in:
Pavel V. Talanov
2015-03-27 17:37:08 +03:00
parent 5cb431c5c4
commit b73bd697e6
68 changed files with 196 additions and 201 deletions
@@ -45,7 +45,7 @@ import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsPackage;
import org.jetbrains.kotlin.cli.jvm.JVMConfigurationKeys;
import org.jetbrains.kotlin.cli.jvm.compiler.CompilerJarLocator;
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
import org.jetbrains.kotlin.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.config.Services;
@@ -102,8 +102,8 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
}
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, arguments.freeArgs);
JetCoreEnvironment environmentForJS =
JetCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES);
KotlinCoreEnvironment environmentForJS =
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES);
Project project = environmentForJS.getProject();
List<JetFile> sourcesFiles = environmentForJS.getSourceFiles();
@@ -179,13 +179,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, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinCoreEnvironment environment =
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinToJVMBytecodeCompiler.compileAndExecuteScript(configuration, paths, environment, scriptArgs);
}
else {
JetCoreEnvironment environment =
JetCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinCoreEnvironment environment =
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment, jar, outputDir, arguments.includeRuntime);
}
return OK;
@@ -109,8 +109,8 @@ public class CompileEnvironmentUtil {
Disposable disposable = Disposer.newDisposable();
try {
JetCoreEnvironment scriptEnvironment =
JetCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinCoreEnvironment scriptEnvironment =
KotlinCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment);
if (generationState == null) {
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " analyze failed:\n" +
@@ -80,7 +80,7 @@ import java.util.ArrayList
import java.util.Comparator
import kotlin.platform.platformStatic
public class JetCoreEnvironment private(
public class KotlinCoreEnvironment private(
parentDisposable: Disposable,
applicationEnvironment: JavaCoreApplicationEnvironment,
configuration: CompilerConfiguration
@@ -204,7 +204,7 @@ public class JetCoreEnvironment private(
platformStatic public fun createForProduction(
parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List<String>
): JetCoreEnvironment {
): KotlinCoreEnvironment {
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
Disposer.register(parentDisposable, object : Disposable {
@@ -216,7 +216,7 @@ public class JetCoreEnvironment private(
}
}
})
val environment = JetCoreEnvironment(parentDisposable, getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths), configuration)
val environment = KotlinCoreEnvironment(parentDisposable, getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths), configuration)
synchronized (APPLICATION_LOCK) {
ourProjectCount++
@@ -226,9 +226,9 @@ public class JetCoreEnvironment private(
TestOnly platformStatic public fun createForTests(
parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: List<String>
): JetCoreEnvironment {
): KotlinCoreEnvironment {
// Tests are supposed to create a single project and dispose it right after use
return JetCoreEnvironment(parentDisposable, createApplicationEnvironment(parentDisposable, configuration, extensionConfigs), configuration)
return KotlinCoreEnvironment(parentDisposable, createApplicationEnvironment(parentDisposable, configuration, extensionConfigs), configuration)
}
private fun getOrCreateApplicationEnvironmentForProduction(configuration: CompilerConfiguration, configFilePaths: List<String>): JavaCoreApplicationEnvironment {
@@ -118,9 +118,9 @@ public class KotlinToJVMBytecodeCompiler {
CompilerConfiguration compilerConfiguration = createCompilerConfiguration(configuration, chunk, directory);
Disposable parentDisposable = Disposer.newDisposable();
JetCoreEnvironment environment = null;
KotlinCoreEnvironment environment = null;
try {
environment = JetCoreEnvironment
environment = KotlinCoreEnvironment
.createForProduction(parentDisposable, compilerConfiguration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
AnalysisResult result = analyze(environment);
@@ -199,7 +199,7 @@ public class KotlinToJVMBytecodeCompiler {
}
public static boolean compileBunchOfSources(
@NotNull JetCoreEnvironment environment,
@NotNull KotlinCoreEnvironment environment,
@Nullable File jar,
@Nullable File outputDir,
boolean includeRuntime
@@ -224,7 +224,7 @@ public class KotlinToJVMBytecodeCompiler {
public static void compileAndExecuteScript(
@NotNull CompilerConfiguration configuration,
@NotNull KotlinPaths paths,
@NotNull JetCoreEnvironment environment,
@NotNull KotlinCoreEnvironment environment,
@NotNull List<String> scriptArgs
) {
Class<?> scriptClass = compileScript(configuration, paths, environment);
@@ -245,7 +245,7 @@ public class KotlinToJVMBytecodeCompiler {
public static Class<?> compileScript(
@NotNull CompilerConfiguration configuration,
@NotNull KotlinPaths paths,
@NotNull JetCoreEnvironment environment
@NotNull KotlinCoreEnvironment environment
) {
List<AnalyzerScriptParameter> scriptParameters = environment.getConfiguration().getList(JVMConfigurationKeys.SCRIPT_PARAMETERS);
if (!scriptParameters.isEmpty()) {
@@ -278,7 +278,7 @@ public class KotlinToJVMBytecodeCompiler {
}
@Nullable
public static GenerationState analyzeAndGenerate(@NotNull JetCoreEnvironment environment) {
public static GenerationState analyzeAndGenerate(@NotNull KotlinCoreEnvironment environment) {
AnalysisResult result = analyze(environment);
if (result == null) {
@@ -291,7 +291,7 @@ public class KotlinToJVMBytecodeCompiler {
}
@Nullable
private static AnalysisResult analyze(@NotNull final JetCoreEnvironment environment) {
private static AnalysisResult analyze(@NotNull final KotlinCoreEnvironment environment) {
MessageCollector collector = environment.getConfiguration().get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
assert collector != null;
@@ -331,7 +331,7 @@ public class KotlinToJVMBytecodeCompiler {
@NotNull
private static GenerationState generate(
@NotNull JetCoreEnvironment environment,
@NotNull KotlinCoreEnvironment environment,
@NotNull AnalysisResult result,
@NotNull List<JetFile> sourceFiles,
@Nullable String moduleId,
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollectorToString;
import org.jetbrains.kotlin.cli.jvm.JVMConfigurationKeys;
import org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport;
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
import org.jetbrains.kotlin.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.codegen.ClassBuilderFactories;
import org.jetbrains.kotlin.codegen.CompilationErrorHandler;
import org.jetbrains.kotlin.codegen.KotlinCodegenFacade;
@@ -103,8 +103,8 @@ public class ReplInterpreter {
private final ScriptMutableDeclarationProviderFactory scriptDeclarationFactory;
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) {
JetCoreEnvironment environment =
JetCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
KotlinCoreEnvironment environment =
KotlinCoreEnvironment.createForProduction(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
Project project = environment.getProject();
this.psiFileFactory = (PsiFileFactoryImpl) PsiFileFactory.getInstance(project);
this.trace = new CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace();