Got rid of using CompilerDependencies in JetCoreEnvironment. CompilerConfiguration is passed instead.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
<orderEntry type="module" module-name="frontend" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -20,10 +20,13 @@ import jet.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.cli.common.CompilerPlugin;
|
||||
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.*;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -50,20 +53,28 @@ public class BytecodeCompiler {
|
||||
* @return compile environment instance
|
||||
*/
|
||||
private K2JVMCompileEnvironmentConfiguration env( String stdlib, String[] classpath ) {
|
||||
CompilerDependencies dependencies = CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), dependencies);
|
||||
List<File> classpathItems = new ArrayList<File>();
|
||||
classpathItems.add(PathUtil.findRtJar());
|
||||
if ((stdlib != null) && (stdlib.trim().length() > 0)) {
|
||||
classpathItems.add(new File(stdlib));
|
||||
}
|
||||
else {
|
||||
classpathItems.add(PathUtil.getDefaultRuntimePath());
|
||||
}
|
||||
if ((classpath != null) && (classpath.length > 0)) {
|
||||
for (String path : classpath) {
|
||||
classpathItems.add(new File(path));
|
||||
}
|
||||
}
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpathItems.toArray(new File[classpathItems.size()]));
|
||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[]{PathUtil.getJdkAnnotationsPath()});
|
||||
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration,
|
||||
CompilerSpecialMode.REGULAR);
|
||||
K2JVMCompileEnvironmentConfiguration
|
||||
env = new K2JVMCompileEnvironmentConfiguration(environment, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR, false);
|
||||
|
||||
if (( stdlib != null ) && ( stdlib.trim().length() > 0 )) {
|
||||
File file = new File(stdlib);
|
||||
CompileEnvironmentUtil.addToClasspath(env.getEnvironment(), file);
|
||||
}
|
||||
|
||||
if (( classpath != null ) && ( classpath.length > 0 )) {
|
||||
CompileEnvironmentUtil.addToClasspath(env.getEnvironment(), classpath);
|
||||
}
|
||||
|
||||
// lets register any compiler plugins
|
||||
env.getCompilerPlugins().addAll(getCompilerPlugins());
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.cli.jvm;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Evgeny Gerashchenko
|
||||
* @since 7/4/12
|
||||
*/
|
||||
public class CompilerConfigurationUtl {
|
||||
// TODO merge with similar K2JVMCompiler method
|
||||
public static CompilerConfiguration getDefaultConfiguration(@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
List<File> classpath = new ArrayList<File>();
|
||||
if (compilerSpecialMode.includeJdk()) {
|
||||
classpath.add(PathUtil.findRtJar());
|
||||
}
|
||||
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||
classpath.add(PathUtil.getDefaultRuntimePath());
|
||||
}
|
||||
File[] annotationsPath = new File[0];
|
||||
if (compilerSpecialMode.includeJdkAnnotations()) {
|
||||
annotationsPath = new File[]{PathUtil.getJdkAnnotationsPath()};
|
||||
}
|
||||
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpath.toArray(new File[classpath.size()]));
|
||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
@@ -55,36 +55,8 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
|
||||
@Override
|
||||
@NotNull
|
||||
protected ExitCode doExecute(K2JVMCompilerArguments arguments, PrintingMessageCollector messageCollector, Disposable rootDisposable) {
|
||||
|
||||
CompilerSpecialMode mode = parseCompilerSpecialMode(arguments);
|
||||
File jdkAnnotationsJar;
|
||||
if (mode.includeJdkAnnotations()) {
|
||||
if (arguments.jdkAnnotations != null) {
|
||||
jdkAnnotationsJar = new File(arguments.jdkAnnotations);
|
||||
}
|
||||
else {
|
||||
jdkAnnotationsJar = PathUtil.getJdkAnnotationsPath();
|
||||
}
|
||||
}
|
||||
else {
|
||||
jdkAnnotationsJar = null;
|
||||
}
|
||||
File runtimeJar;
|
||||
|
||||
if (mode.includeKotlinRuntime()) {
|
||||
if (arguments.stdlib != null) {
|
||||
runtimeJar = new File(arguments.stdlib);
|
||||
}
|
||||
else {
|
||||
runtimeJar = PathUtil.getDefaultRuntimePath();
|
||||
}
|
||||
}
|
||||
else {
|
||||
runtimeJar = null;
|
||||
}
|
||||
|
||||
// will be ignored later
|
||||
CompilerDependencies dependencies = new CompilerDependencies(mode, PathUtil.findRtJar(), jdkAnnotationsJar, runtimeJar);
|
||||
CompilerConfiguration compilerConfiguration = createCompilerConfiguration(arguments);
|
||||
|
||||
final List<String> argumentsSourceDirs = arguments.getSourceDirs();
|
||||
if (!arguments.script &&
|
||||
@@ -93,12 +65,13 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
|
||||
arguments.freeArgs.isEmpty() &&
|
||||
(argumentsSourceDirs == null || argumentsSourceDirs.size() == 0)) {
|
||||
|
||||
ReplFromTerminal.run(rootDisposable, dependencies, createCompilerConfiguration(arguments));
|
||||
ReplFromTerminal.run(rootDisposable, compilerConfiguration, mode);
|
||||
return ExitCode.OK;
|
||||
}
|
||||
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, dependencies);
|
||||
K2JVMCompileEnvironmentConfiguration configuration = new K2JVMCompileEnvironmentConfiguration(environment, messageCollector, arguments.script);
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, compilerConfiguration, mode);
|
||||
K2JVMCompileEnvironmentConfiguration configuration = new K2JVMCompileEnvironmentConfiguration(environment, messageCollector,
|
||||
arguments.script);
|
||||
|
||||
messageCollector.report(CompilerMessageSeverity.LOGGING, "Configuring the compilation environment",
|
||||
CompilerMessageLocation.NO_LOCATION);
|
||||
|
||||
@@ -27,13 +27,14 @@ import jet.modules.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.cli.jvm.CompilerConfigurationUtl;
|
||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||
import org.jetbrains.jet.codegen.GeneratedClassLoader;
|
||||
import org.jetbrains.jet.codegen.GenerationState;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -139,8 +140,8 @@ public class CompileEnvironmentUtil {
|
||||
|
||||
}
|
||||
};
|
||||
CompilerDependencies dependencies = CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, dependencies);
|
||||
CompilerConfiguration configuration = CompilerConfigurationUtl.getDefaultConfiguration(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration, CompilerSpecialMode.REGULAR);
|
||||
scriptEnvironment.addSources(moduleScriptFile);
|
||||
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.parsing.JetParser;
|
||||
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
|
||||
import org.jetbrains.jet.lang.resolve.java.extAnnotations.CoreAnnotationsProvider;
|
||||
@@ -56,21 +55,23 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJS(Disposable disposable) {
|
||||
return new JetCoreEnvironment(disposable, CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.JS));
|
||||
return new JetCoreEnvironment(disposable, new CompilerConfiguration(), CompilerSpecialMode.JS);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJVM(Disposable disposable, @NotNull CompilerDependencies dependencies) {
|
||||
return new JetCoreEnvironment(disposable, dependencies);
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJVM(Disposable disposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
return new JetCoreEnvironment(disposable, configuration, compilerSpecialMode);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private final CompilerSpecialMode compilerSpecialMode;
|
||||
|
||||
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerDependencies compilerDependencies) {
|
||||
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
super(parentDisposable);
|
||||
|
||||
this.compilerSpecialMode = compilerDependencies.getCompilerSpecialMode();
|
||||
this.compilerSpecialMode = compilerSpecialMode;
|
||||
|
||||
registerFileType(JetFileType.INSTANCE, "kt");
|
||||
registerFileType(JetFileType.INSTANCE, "kts");
|
||||
@@ -86,24 +87,10 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
.getExtensionPoint(PsiElementFinder.EP_NAME)
|
||||
.registerExtension(new JavaElementFinder(myProject));
|
||||
|
||||
CompilerSpecialMode compilerSpecialMode = compilerDependencies.getCompilerSpecialMode();
|
||||
|
||||
if (compilerSpecialMode.includeJdk()) {
|
||||
addToClasspath(compilerDependencies.getJdkJar());
|
||||
}
|
||||
|
||||
annotationsProvider = new CoreAnnotationsProvider();
|
||||
if (compilerSpecialMode.includeJdkAnnotations()) {
|
||||
for (VirtualFile root : compilerDependencies.getJdkAnnotationsRoots()) {
|
||||
annotationsProvider.addExternalAnnotationsRoot(root);
|
||||
}
|
||||
}
|
||||
|
||||
myProject.registerService(ExternalAnnotationsProvider.class, annotationsProvider);
|
||||
|
||||
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||
addToClasspath(compilerDependencies.getRuntimeJar());
|
||||
}
|
||||
configure(configuration);
|
||||
|
||||
JetStandardLibrary.initialize(getProject());
|
||||
}
|
||||
@@ -196,12 +183,15 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
public void configure(@NotNull CompilerConfiguration compilerConfiguration) {
|
||||
File[] classpath = compilerConfiguration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
File[] annotationsPath = compilerConfiguration.getUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
||||
assert classpath != null && annotationsPath != null;
|
||||
for (File path : classpath) {
|
||||
addToClasspath(path);
|
||||
if (classpath != null) {
|
||||
for (File path : classpath) {
|
||||
addToClasspath(path);
|
||||
}
|
||||
}
|
||||
for (File path : annotationsPath) {
|
||||
addExternalAnnotationsRoot(PathUtil.jarFileOrDirectoryToVirtualFile(path));
|
||||
if (annotationsPath != null) {
|
||||
for (File path : annotationsPath) {
|
||||
addExternalAnnotationsRoot(PathUtil.jarFileOrDirectoryToVirtualFile(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import jline.console.history.FileHistory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.utils.ExceptionUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -43,13 +44,13 @@ public class ReplFromTerminal {
|
||||
|
||||
public ReplFromTerminal(
|
||||
@NotNull final Disposable disposable,
|
||||
@NotNull final CompilerDependencies compilerDependencies,
|
||||
@NotNull final CompilerConfiguration compilerConfiguration) {
|
||||
@NotNull final CompilerConfiguration compilerConfiguration,
|
||||
@NotNull final CompilerSpecialMode mode) {
|
||||
new Thread("initialize-repl") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
replInterpreter = new ReplInterpreter(disposable, compilerDependencies, compilerConfiguration);
|
||||
replInterpreter = new ReplInterpreter(disposable, compilerConfiguration, mode);
|
||||
} catch (Throwable e) {
|
||||
replInitializationFailed = e;
|
||||
}
|
||||
@@ -195,9 +196,9 @@ public class ReplFromTerminal {
|
||||
return Arrays.asList(command.split(" "));
|
||||
}
|
||||
|
||||
public static void run(@NotNull Disposable disposable, @NotNull CompilerDependencies compilerDependencies,
|
||||
@NotNull CompilerConfiguration compilerConfiguration) {
|
||||
new ReplFromTerminal(disposable, compilerDependencies, compilerConfiguration).doRun();
|
||||
public static void run(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration,
|
||||
@NotNull CompilerSpecialMode mode) {
|
||||
new ReplFromTerminal(disposable, configuration, mode).doRun();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,13 +45,8 @@ import org.jetbrains.jet.lang.descriptors.NamespaceDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceLikeBuilderDummy;
|
||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.ScriptHeaderResolver;
|
||||
import org.jetbrains.jet.lang.resolve.TopDownAnalysisParameters;
|
||||
import org.jetbrains.jet.lang.resolve.TraceBasedRedeclarationHandler;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -94,9 +89,8 @@ public class ReplInterpreter {
|
||||
@NotNull
|
||||
private final ModuleDescriptor module;
|
||||
|
||||
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerDependencies compilerDependencies,
|
||||
@NotNull CompilerConfiguration configuration) {
|
||||
jetCoreEnvironment = new JetCoreEnvironment(disposable, compilerDependencies);
|
||||
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration, @NotNull CompilerSpecialMode mode) {
|
||||
jetCoreEnvironment = new JetCoreEnvironment(disposable, configuration, mode);
|
||||
jetCoreEnvironment.configure(configuration);
|
||||
Project project = jetCoreEnvironment.getProject();
|
||||
trace = new BindingTraceContext();
|
||||
@@ -106,8 +100,7 @@ public class ReplInterpreter {
|
||||
false,
|
||||
true,
|
||||
Collections.<AnalyzerScriptParameter>emptyList());
|
||||
injector = new InjectorForTopDownAnalyzerForJvm(project, topDownAnalysisParameters, trace, module,
|
||||
compilerDependencies.getCompilerSpecialMode());
|
||||
injector = new InjectorForTopDownAnalyzerForJvm(project, topDownAnalysisParameters, trace, module, mode);
|
||||
|
||||
List<URL> classpath = Lists.newArrayList();
|
||||
|
||||
|
||||
@@ -180,8 +180,9 @@ public class JetTestUtils {
|
||||
}
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable, @NotNull CompilerSpecialMode compilerSpecialMode) {
|
||||
JetCoreEnvironment environment =
|
||||
new JetCoreEnvironment(disposable, CompileCompilerDependenciesTest.compilerDependenciesForTests(compilerSpecialMode, true));
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(compilerSpecialMode, true),
|
||||
compilerSpecialMode);
|
||||
environment.addToClasspath(getAnnotationsJar());
|
||||
return environment;
|
||||
}
|
||||
@@ -253,7 +254,8 @@ public class JetTestUtils {
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithFullJdk(Disposable disposable) {
|
||||
return new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false));
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.REGULAR, false),
|
||||
CompilerSpecialMode.REGULAR);
|
||||
}
|
||||
|
||||
public static PsiFile createFile(@NonNls String name, String text, @NotNull Project project) {
|
||||
|
||||
+6
-9
@@ -30,19 +30,15 @@ import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.TimeUtils;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -153,8 +149,9 @@ public class ResolveDescriptorsFromExternalLibraries {
|
||||
jetCoreEnvironment.addToClasspath(jar);
|
||||
}
|
||||
else {
|
||||
CompilerDependencies compilerDependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.STDLIB, false);
|
||||
jetCoreEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(junk, compilerDependencies);
|
||||
CompilerConfiguration configuration =
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.STDLIB, false);
|
||||
jetCoreEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(junk, configuration, CompilerSpecialMode.STDLIB);
|
||||
if (!PathUtil.findRtJar().equals(jar)) {
|
||||
throw new RuntimeException("rt.jar mismatch: " + jar + ", " + PathUtil.findRtJar());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.TopDownAnalysisParameters;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.junit.After;
|
||||
@@ -47,9 +46,9 @@ public abstract class AbstractLazyResolveTest {
|
||||
}
|
||||
};
|
||||
|
||||
protected final CompilerDependencies
|
||||
compilerDependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, true);
|
||||
protected final JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(rootDisposable, compilerDependencies);
|
||||
protected final JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(rootDisposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JDK_HEADERS, true),
|
||||
CompilerSpecialMode.JDK_HEADERS);
|
||||
protected final Project project = jetCoreEnvironment.getProject();
|
||||
|
||||
@BeforeClass
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys;
|
||||
import org.jetbrains.jet.cli.jvm.repl.ReplInterpreter;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
@@ -54,13 +53,12 @@ public class ReplInterpreterTest {
|
||||
}
|
||||
|
||||
private void testFile(@NotNull String relativePath) {
|
||||
CompilerDependencies compilerDependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, false);
|
||||
CompilerConfiguration configuration =
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JDK_HEADERS, false);
|
||||
File[] classpath = configuration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
assert classpath != null;
|
||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, ArrayUtil.append(classpath, new File("out/production/runtime")));
|
||||
ReplInterpreter repl = new ReplInterpreter(disposable, compilerDependencies, configuration);
|
||||
ReplInterpreter repl = new ReplInterpreter(disposable, configuration, CompilerSpecialMode.JDK_HEADERS);
|
||||
|
||||
ReplSessionTestFile file = ReplSessionTestFile.load(new File("compiler/testData/repl/" + relativePath));
|
||||
for (ReplSessionTestFile.OneLine t : file.getLines()) {
|
||||
|
||||
@@ -51,9 +51,9 @@ public abstract class TestWithEnvironment extends UsefulTestCase {
|
||||
}
|
||||
|
||||
protected void createEnvironmentWithMockJdkAndIdeaAnnotations() {
|
||||
myEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(getTestRootDisposable(),
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(
|
||||
CompilerSpecialMode.JS,
|
||||
true));
|
||||
myEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(
|
||||
getTestRootDisposable(),
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(CompilerSpecialMode.JS, true),
|
||||
CompilerSpecialMode.JS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user