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
@@ -16,7 +16,7 @@
package org.jetbrains.jet;
import org.jetbrains.jet.codegen.ForTestCompileStdlib;
import org.jetbrains.jet.codegen.ForTestCompileRuntime;
import org.junit.Test;
/**
@@ -26,7 +26,7 @@ public class CompileStdlibTest {
@Test
public void compile() {
ForTestCompileStdlib.stdlibJarForTests();
ForTestCompileRuntime.runtimeJarForTests();
}
}
@@ -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();
@@ -19,7 +19,7 @@ package org.jetbrains.jet.compiler;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestCase;
import org.jetbrains.jet.cli.KotlinCompiler;
import org.jetbrains.jet.codegen.ForTestCompileStdlib;
import org.jetbrains.jet.codegen.ForTestCompileRuntime;
import org.jetbrains.jet.parsing.JetParsingTest;
import org.junit.Assert;
@@ -53,7 +53,7 @@ public class CompileEnvironmentTest extends TestCase {
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
try {
File stdlib = ForTestCompileStdlib.stdlibJarForTests();
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
File resultJar = new File(tempDir, "result.jar");
KotlinCompiler.ExitCode rv = new KotlinCompiler().exec("-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts",
"-jar", resultJar.getAbsolutePath(),
@@ -84,7 +84,7 @@ public class CompileEnvironmentTest extends TestCase {
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
try {
File out = new File(tempDir, "out");
File stdlib = ForTestCompileStdlib.stdlibJarForTests();
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec("-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt",
"-output", out.getAbsolutePath(),
"-stdlib", stdlib.getAbsolutePath());
@@ -29,7 +29,7 @@ import com.intellij.testFramework.LightProjectDescriptor;
import org.apache.commons.lang.SystemUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.codegen.ForTestCompileStdlib;
import org.jetbrains.jet.codegen.ForTestCompileRuntime;
/**
* @author Evgeny Gerashchenko
@@ -54,7 +54,7 @@ public class JetWithJdkAndRuntimeLightProjectDescriptor implements LightProjectD
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable ContentEntry contentEntry) {
Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("ktl").getModifiableModel();
VirtualFile cd = JarFileSystem.getInstance().findFileByPath(ForTestCompileStdlib.stdlibJarForTests() + "!/");
VirtualFile cd = JarFileSystem.getInstance().findFileByPath(ForTestCompileRuntime.runtimeJarForTests() + "!/");
assert cd != null;
modifiableModel.addRoot(cd, OrderRootType.CLASSES);
modifiableModel.commit();