Switch to templates in the separate script runtime

This commit is contained in:
Ilya Chernikov
2016-10-11 10:03:41 +02:00
parent c2b5c11781
commit 846797ff61
36 changed files with 99 additions and 128 deletions
@@ -51,6 +51,11 @@ public class ForTestCompileRuntime {
return assertExists(new File("dist/kotlinc/lib/kotlin-reflect.jar"));
}
@NotNull
public static File scriptRuntimeJarForTests() {
return assertExists(new File("dist/kotlinc/lib/kotlin-script-runtime.jar"));
}
@NotNull
private static File assertExists(@NotNull File file) {
if (!file.exists()) {
@@ -63,7 +68,7 @@ public class ForTestCompileRuntime {
public static synchronized ClassLoader runtimeAndReflectJarClassLoader() {
ClassLoader loader = reflectJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(runtimeJarForTests(), reflectJarForTests(), kotlinTestJarForTests());
loader = createClassLoader(runtimeJarForTests(), reflectJarForTests(), scriptRuntimeJarForTests(), kotlinTestJarForTests());
reflectJarClassLoader = new SoftReference<ClassLoader>(loader);
}
return loader;
@@ -73,7 +78,7 @@ public class ForTestCompileRuntime {
public static synchronized ClassLoader runtimeJarClassLoader() {
ClassLoader loader = runtimeJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(runtimeJarForTests());
loader = createClassLoader(runtimeJarForTests(), scriptRuntimeJarForTests());
runtimeJarClassLoader = new SoftReference<ClassLoader>(loader);
}
return loader;
@@ -468,10 +468,12 @@ public class KotlinTestUtils {
if (configurationKind.getWithRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests());
}
else if (configurationKind.getWithMockRuntime()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.mockRuntimeJarForTests());
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
}
if (configurationKind.getWithReflection()) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.reflectJarForTests());