Got rid of actual using CompilerDependencies in REPL interpreter classes.

This commit is contained in:
Evgeny Gerashchenko
2012-07-04 14:56:16 +04:00
parent 60ecd1d394
commit 590ab38e55
5 changed files with 52 additions and 21 deletions
@@ -17,13 +17,19 @@
package org.jetbrains.jet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys;
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileBuiltins;
import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations;
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
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.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Stepan Koltsov
*/
@@ -55,4 +61,23 @@ public class CompileCompilerDependenciesTest {
compilerSpecialMode.includeJdkAnnotations() ? ForTestPackJdkAnnotations.jdkAnnotationsForTests() : null,
compilerSpecialMode.includeKotlinRuntime() ? ForTestCompileRuntime.runtimeJarForTests() : null);
}
public static CompilerConfiguration compilerConfigurationForTests(@NotNull CompilerSpecialMode compilerSpecialMode, boolean mockJdk) {
List<File> classpath = new ArrayList<File>();
if (compilerSpecialMode.includeJdk()) {
classpath.add(mockJdk ? JetTestUtils.findMockJdkRtJar() : CompilerDependencies.findRtJar());
}
if (compilerSpecialMode.includeKotlinRuntime()) {
classpath.add(ForTestCompileRuntime.runtimeJarForTests());
}
File[] annotationsPath = new File[0];
if (compilerSpecialMode.includeJdkAnnotations()) {
annotationsPath = new File[]{ForTestPackJdkAnnotations.jdkAnnotationsForTests()};
}
CompilerConfiguration configuration = new CompilerConfiguration();
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpath.toArray(new File[classpath.size()]));
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
return configuration;
}
}