rename stdlib to runtime
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet;
|
package org.jetbrains.jet;
|
||||||
|
|
||||||
import org.jetbrains.jet.codegen.ForTestCompileStdlib;
|
import org.jetbrains.jet.codegen.ForTestCompileRuntime;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +26,7 @@ public class CompileStdlibTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void compile() {
|
public void compile() {
|
||||||
ForTestCompileStdlib.stdlibJarForTests();
|
ForTestCompileRuntime.runtimeJarForTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -38,26 +38,26 @@ import java.util.jar.JarOutputStream;
|
|||||||
/**
|
/**
|
||||||
* Compile stdlib.jar that can be used in tests
|
* Compile stdlib.jar that can be used in tests
|
||||||
*
|
*
|
||||||
* @see #stdlibJarForTests()
|
* @see #runtimeJarForTests
|
||||||
*
|
*
|
||||||
* @author Stepan Koltsov
|
* @author Stepan Koltsov
|
||||||
*/
|
*/
|
||||||
public class ForTestCompileStdlib {
|
public class ForTestCompileRuntime {
|
||||||
private static File stdlibJarFile;
|
private static File stdlibJarFile;
|
||||||
|
|
||||||
private ForTestCompileStdlib() {
|
private ForTestCompileRuntime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File doCompile() throws Exception {
|
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");
|
File classesDir = new File(tmpDir, "classes");
|
||||||
|
|
||||||
FileUtil.createParentDirs(new File(classesDir, "dummy"));
|
FileUtil.createParentDirs(new File(classesDir, "dummy"));
|
||||||
compileJavaPartOfStdlib(classesDir);
|
compileJavaPartOfBuiltins(classesDir);
|
||||||
compileKotlinPartOfStdlib(classesDir);
|
compileStdlib(classesDir);
|
||||||
|
|
||||||
FileOutputStream stdlibJar = new FileOutputStream(jarFile);
|
FileOutputStream stdlibJar = new FileOutputStream(jarFile);
|
||||||
try {
|
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,
|
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec(System.err,
|
||||||
"-output", destdir.getPath(),
|
"-output", destdir.getPath(),
|
||||||
"-src", "./libraries/stdlib/src",
|
"-src", "./libraries/stdlib/src",
|
||||||
@@ -123,7 +123,7 @@ public class ForTestCompileStdlib {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void compileJavaPartOfStdlib(File destdir) throws IOException {
|
private static void compileJavaPartOfBuiltins(File destdir) throws IOException {
|
||||||
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
|
||||||
|
|
||||||
StandardJavaFileManager fileManager = javaCompiler.getStandardFileManager(null, Locale.ENGLISH, Charset.forName("utf-8"));
|
StandardJavaFileManager fileManager = javaCompiler.getStandardFileManager(null, Locale.ENGLISH, Charset.forName("utf-8"));
|
||||||
@@ -144,10 +144,10 @@ public class ForTestCompileStdlib {
|
|||||||
|
|
||||||
private static Throwable compilationException;
|
private static Throwable compilationException;
|
||||||
|
|
||||||
public static File stdlibJarForTests() {
|
public static File runtimeJarForTests() {
|
||||||
synchronized (ForTestCompileStdlib.class) {
|
synchronized (ForTestCompileRuntime.class) {
|
||||||
if (compilationException != null) {
|
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()) {
|
if (stdlibJarFile == null || !stdlibJarFile.exists()) {
|
||||||
try {
|
try {
|
||||||
@@ -37,7 +37,7 @@ public class StdlibTest extends CodegenTestCase {
|
|||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
createEnvironmentWithFullJdk();
|
createEnvironmentWithFullJdk();
|
||||||
myEnvironment.addToClasspath(ForTestCompileStdlib.stdlibJarForTests());
|
myEnvironment.addToClasspath(ForTestCompileRuntime.runtimeJarForTests());
|
||||||
File junitJar = new File("libraries/lib/junit-4.9.jar");
|
File junitJar = new File("libraries/lib/junit-4.9.jar");
|
||||||
|
|
||||||
if (!junitJar.exists()) {
|
if (!junitJar.exists()) {
|
||||||
@@ -52,7 +52,7 @@ public class StdlibTest extends CodegenTestCase {
|
|||||||
protected GeneratedClassLoader createClassLoader(ClassFileFactory codegens) throws MalformedURLException {
|
protected GeneratedClassLoader createClassLoader(ClassFileFactory codegens) throws MalformedURLException {
|
||||||
return new GeneratedClassLoader(
|
return new GeneratedClassLoader(
|
||||||
codegens,
|
codegens,
|
||||||
new URLClassLoader(new URL[]{ForTestCompileStdlib.stdlibJarForTests().toURI().toURL()},
|
new URLClassLoader(new URL[]{ForTestCompileRuntime.runtimeJarForTests().toURI().toURL()},
|
||||||
getClass().getClassLoader()));
|
getClass().getClassLoader()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class TestlibTest extends CodegenTestCase {
|
|||||||
try {
|
try {
|
||||||
CompileSession session = new CompileSession(myEnvironment, MessageRenderer.PLAIN, System.err, false, CompilerSpecialMode.REGULAR);
|
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");
|
File junitJar = new File("libraries/lib/junit-4.9.jar");
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class TestlibTest extends CodegenTestCase {
|
|||||||
|
|
||||||
final GeneratedClassLoader loader = new GeneratedClassLoader(
|
final GeneratedClassLoader loader = new GeneratedClassLoader(
|
||||||
classFileFactory,
|
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()));
|
TestCase.class.getClassLoader()));
|
||||||
|
|
||||||
JetTypeMapper typeMapper = state.getInjector().getJetTypeMapper();
|
JetTypeMapper typeMapper = state.getInjector().getJetTypeMapper();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package org.jetbrains.jet.compiler;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.jetbrains.jet.cli.KotlinCompiler;
|
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.jetbrains.jet.parsing.JetParsingTest;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class CompileEnvironmentTest extends TestCase {
|
|||||||
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
|
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File stdlib = ForTestCompileStdlib.stdlibJarForTests();
|
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
|
||||||
File resultJar = new File(tempDir, "result.jar");
|
File resultJar = new File(tempDir, "result.jar");
|
||||||
KotlinCompiler.ExitCode rv = new KotlinCompiler().exec("-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts",
|
KotlinCompiler.ExitCode rv = new KotlinCompiler().exec("-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts",
|
||||||
"-jar", resultJar.getAbsolutePath(),
|
"-jar", resultJar.getAbsolutePath(),
|
||||||
@@ -84,7 +84,7 @@ public class CompileEnvironmentTest extends TestCase {
|
|||||||
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
|
File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest");
|
||||||
try {
|
try {
|
||||||
File out = new File(tempDir, "out");
|
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",
|
KotlinCompiler.ExitCode exitCode = new KotlinCompiler().exec("-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt",
|
||||||
"-output", out.getAbsolutePath(),
|
"-output", out.getAbsolutePath(),
|
||||||
"-stdlib", stdlib.getAbsolutePath());
|
"-stdlib", stdlib.getAbsolutePath());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import com.intellij.testFramework.LightProjectDescriptor;
|
|||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.codegen.ForTestCompileStdlib;
|
import org.jetbrains.jet.codegen.ForTestCompileRuntime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Evgeny Gerashchenko
|
* @author Evgeny Gerashchenko
|
||||||
@@ -54,7 +54,7 @@ public class JetWithJdkAndRuntimeLightProjectDescriptor implements LightProjectD
|
|||||||
@Override
|
@Override
|
||||||
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable ContentEntry contentEntry) {
|
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @Nullable ContentEntry contentEntry) {
|
||||||
Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("ktl").getModifiableModel();
|
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;
|
assert cd != null;
|
||||||
modifiableModel.addRoot(cd, OrderRootType.CLASSES);
|
modifiableModel.addRoot(cd, OrderRootType.CLASSES);
|
||||||
modifiableModel.commit();
|
modifiableModel.commit();
|
||||||
|
|||||||
Reference in New Issue
Block a user