rename stdlib to runtime

This commit is contained in:
Stepan Koltsov
2012-04-08 23:31:29 +04:00
parent 09ddfb714e
commit d74c217936
6 changed files with 23 additions and 23 deletions
@@ -38,26 +38,26 @@ import java.util.jar.JarOutputStream;
/**
* Compile stdlib.jar that can be used in tests
*
* @see #stdlibJarForTests()
* @see #runtimeJarForTests
*
* @author Stepan Koltsov
*/
public class ForTestCompileStdlib {
public class ForTestCompileRuntime {
private static File stdlibJarFile;
private ForTestCompileStdlib() {
private ForTestCompileRuntime() {
}
private static File doCompile() throws Exception {
File tmpDir = JetTestUtils.tmpDir("stdlibjar");
File tmpDir = JetTestUtils.tmpDir("runtimejar");
File jarFile = new File(tmpDir, "stdlib.jar");
File jarFile = new File(tmpDir, "runtime.jar");
File classesDir = new File(tmpDir, "classes");
FileUtil.createParentDirs(new File(classesDir, "dummy"));
compileJavaPartOfStdlib(classesDir);
compileKotlinPartOfStdlib(classesDir);
compileJavaPartOfBuiltins(classesDir);
compileStdlib(classesDir);
FileOutputStream stdlibJar = new FileOutputStream(jarFile);
try {
@@ -97,7 +97,7 @@ public class ForTestCompileStdlib {
}
}
private static void compileKotlinPartOfStdlib(File destdir) throws IOException {
private static void compileStdlib(File destdir) throws IOException {
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(System.err,
"-output", destdir.getPath(),
"-src", "./libraries/stdlib/src",
@@ -123,7 +123,7 @@ public class ForTestCompileStdlib {
return r;
}
private static void compileJavaPartOfStdlib(File destdir) throws IOException {
private static void compileJavaPartOfBuiltins(File destdir) throws IOException {
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = javaCompiler.getStandardFileManager(null, Locale.ENGLISH, Charset.forName("utf-8"));
@@ -144,10 +144,10 @@ public class ForTestCompileStdlib {
private static Throwable compilationException;
public static File stdlibJarForTests() {
synchronized (ForTestCompileStdlib.class) {
public static File runtimeJarForTests() {
synchronized (ForTestCompileRuntime.class) {
if (compilationException != null) {
throw new RuntimeException("stdlib compilation failed in previous tests: " + compilationException, compilationException);
throw new RuntimeException("runtime compilation failed in previous tests: " + compilationException, compilationException);
}
if (stdlibJarFile == null || !stdlibJarFile.exists()) {
try {
@@ -37,7 +37,7 @@ public class StdlibTest extends CodegenTestCase {
protected void setUp() throws Exception {
super.setUp();
createEnvironmentWithFullJdk();
myEnvironment.addToClasspath(ForTestCompileStdlib.stdlibJarForTests());
myEnvironment.addToClasspath(ForTestCompileRuntime.runtimeJarForTests());
File junitJar = new File("libraries/lib/junit-4.9.jar");
if (!junitJar.exists()) {
@@ -52,7 +52,7 @@ public class StdlibTest extends CodegenTestCase {
protected GeneratedClassLoader createClassLoader(ClassFileFactory codegens) throws MalformedURLException {
return new GeneratedClassLoader(
codegens,
new URLClassLoader(new URL[]{ForTestCompileStdlib.stdlibJarForTests().toURI().toURL()},
new URLClassLoader(new URL[]{ForTestCompileRuntime.runtimeJarForTests().toURI().toURL()},
getClass().getClassLoader()));
}
@@ -73,7 +73,7 @@ public class TestlibTest extends CodegenTestCase {
try {
CompileSession session = new CompileSession(myEnvironment, MessageRenderer.PLAIN, System.err, false, CompilerSpecialMode.REGULAR);
myEnvironment.addToClasspath(ForTestCompileStdlib.stdlibJarForTests());
myEnvironment.addToClasspath(ForTestCompileRuntime.runtimeJarForTests());
File junitJar = new File("libraries/lib/junit-4.9.jar");
@@ -96,7 +96,7 @@ public class TestlibTest extends CodegenTestCase {
final GeneratedClassLoader loader = new GeneratedClassLoader(
classFileFactory,
new URLClassLoader(new URL[]{ForTestCompileStdlib.stdlibJarForTests().toURI().toURL(), junitJar.toURI().toURL()},
new URLClassLoader(new URL[]{ForTestCompileRuntime.runtimeJarForTests().toURI().toURL(), junitJar.toURI().toURL()},
TestCase.class.getClassLoader()));
JetTypeMapper typeMapper = state.getInjector().getJetTypeMapper();