Remove usages of kotlin-stdlib-coroutines.jar in tests
This commit is contained in:
@@ -413,15 +413,9 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
@NotNull
|
||||
protected GeneratedClassLoader createClassLoader() {
|
||||
ClassLoader classLoader;
|
||||
if (configurationKind.getWithReflection() && configurationKind.getWithCoroutines()) {
|
||||
classLoader = ForTestCompileRuntime.reflectAndCoroutinesJarClassLoader();
|
||||
}
|
||||
else if (configurationKind.getWithReflection()) {
|
||||
if (configurationKind.getWithReflection()) {
|
||||
classLoader = ForTestCompileRuntime.runtimeAndReflectJarClassLoader();
|
||||
}
|
||||
else if (configurationKind.getWithCoroutines()) {
|
||||
classLoader = ForTestCompileRuntime.runtimeAndCoroutinesJarClassLoader();
|
||||
}
|
||||
else {
|
||||
classLoader = ForTestCompileRuntime.runtimeJarClassLoader();
|
||||
}
|
||||
@@ -685,9 +679,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
if (loadAndroidAnnotations) {
|
||||
javaClasspath.add(ForTestCompileRuntime.androidAnnotationsForTests().getPath());
|
||||
}
|
||||
if (configurationKind.getWithCoroutines()) {
|
||||
javaClasspath.add(ForTestCompileRuntime.coroutinesJarForTests().getPath());
|
||||
}
|
||||
|
||||
javaClassesOutputDirectory = CodegenTestUtil.compileJava(
|
||||
findJavaSourcesInDirectory(javaSourceDir), javaClasspath, javacOptions
|
||||
@@ -714,10 +705,8 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
return (addReflect && addCoroutines) ? ConfigurationKind.ALL :
|
||||
addReflect ? ConfigurationKind.WITH_REFLECT :
|
||||
addCoroutines ? ConfigurationKind.WITH_COROUTINES :
|
||||
addRuntime ? ConfigurationKind.NO_KOTLIN_REFLECT :
|
||||
return addReflect ? ConfigurationKind.ALL :
|
||||
(addRuntime || addCoroutines) ? ConfigurationKind.NO_KOTLIN_REFLECT :
|
||||
ConfigurationKind.JDK_ONLY;
|
||||
}
|
||||
|
||||
|
||||
+1
-32
@@ -19,19 +19,12 @@ import java.util.List;
|
||||
public class ForTestCompileRuntime {
|
||||
private static volatile SoftReference<ClassLoader> reflectJarClassLoader = new SoftReference<>(null);
|
||||
private static volatile SoftReference<ClassLoader> runtimeJarClassLoader = new SoftReference<>(null);
|
||||
private static volatile SoftReference<ClassLoader> coroutinesJarClassLoader = new SoftReference<>(null);
|
||||
private static volatile SoftReference<ClassLoader> coroutinesAndReflectJarClassLoader = new SoftReference<>(null);
|
||||
|
||||
@NotNull
|
||||
public static File runtimeJarForTests() {
|
||||
return assertExists(new File("dist/kotlinc/lib/kotlin-stdlib.jar"));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File coroutinesJarForTests() {
|
||||
return assertExists(new File("dist/kotlin-stdlib-coroutines.jar"));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File minimalRuntimeJarForTests() {
|
||||
return assertExists(new File("dist/kotlin-stdlib-minimal-for-test.jar"));
|
||||
@@ -114,36 +107,12 @@ public class ForTestCompileRuntime {
|
||||
public static synchronized ClassLoader runtimeAndReflectJarClassLoader() {
|
||||
ClassLoader loader = reflectJarClassLoader.get();
|
||||
if (loader == null) {
|
||||
loader = createClassLoader(runtimeJarForTests(), coroutinesJarForTests(), reflectJarForTests(), scriptRuntimeJarForTests(),
|
||||
kotlinTestJarForTests());
|
||||
loader = createClassLoader(runtimeJarForTests(), reflectJarForTests(), scriptRuntimeJarForTests(), kotlinTestJarForTests());
|
||||
reflectJarClassLoader = new SoftReference<>(loader);
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static synchronized ClassLoader runtimeAndCoroutinesJarClassLoader() {
|
||||
ClassLoader loader = coroutinesJarClassLoader.get();
|
||||
if (loader == null) {
|
||||
loader = createClassLoader(runtimeJarForTests(), coroutinesJarForTests(), scriptRuntimeJarForTests(), kotlinTestJarForTests());
|
||||
coroutinesJarClassLoader = new SoftReference<>(loader);
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static synchronized ClassLoader reflectAndCoroutinesJarClassLoader() {
|
||||
ClassLoader loader = coroutinesAndReflectJarClassLoader.get();
|
||||
if (loader == null) {
|
||||
loader = createClassLoader(
|
||||
runtimeJarForTests(), reflectJarForTests(), coroutinesJarForTests(),
|
||||
scriptRuntimeJarForTests(), kotlinTestJarForTests()
|
||||
);
|
||||
coroutinesAndReflectJarClassLoader = new SoftReference<>(loader);
|
||||
}
|
||||
return loader;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static synchronized ClassLoader runtimeJarClassLoader() {
|
||||
ClassLoader loader = runtimeJarClassLoader.get();
|
||||
|
||||
@@ -8,8 +8,7 @@ package org.jetbrains.kotlin.test
|
||||
enum class ConfigurationKind(
|
||||
val withRuntime: Boolean = false,
|
||||
val withMockRuntime: Boolean = false,
|
||||
val withReflection: Boolean = false,
|
||||
val withCoroutines: Boolean = false
|
||||
val withReflection: Boolean = false
|
||||
) {
|
||||
/** JDK without any kotlin runtime */
|
||||
JDK_NO_RUNTIME(),
|
||||
@@ -17,10 +16,6 @@ enum class ConfigurationKind(
|
||||
JDK_ONLY(withMockRuntime = true),
|
||||
/** JDK + kotlin runtime but without reflection */
|
||||
NO_KOTLIN_REFLECT(withRuntime = true),
|
||||
/** JDK + kotlin runtime + coroutines */
|
||||
WITH_COROUTINES(withCoroutines = true, withRuntime = true),
|
||||
/** JDK + kotlin runtime + kotlin reflection */
|
||||
WITH_REFLECT(withRuntime = true, withReflection = true),
|
||||
/** JDK + kotlin runtime + kotlin reflection + coroutines */
|
||||
ALL(withRuntime = true, withReflection = true, withCoroutines = true)
|
||||
ALL(withRuntime = true, withReflection = true)
|
||||
}
|
||||
|
||||
@@ -582,9 +582,6 @@ public class KotlinTestUtils {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, new File(System.getProperty("java.home")));
|
||||
}
|
||||
|
||||
if (configurationKind.getWithCoroutines()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
|
||||
}
|
||||
if (configurationKind.getWithRuntime()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
|
||||
|
||||
@@ -577,9 +577,6 @@ public class KotlinTestUtils {
|
||||
configuration.put(JVMConfigurationKeys.JDK_HOME, new File(System.getProperty("java.home")));
|
||||
}
|
||||
|
||||
if (configurationKind.getWithCoroutines()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
|
||||
}
|
||||
if (configurationKind.getWithRuntime()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
|
||||
|
||||
@@ -577,9 +577,6 @@ public class KotlinTestUtils {
|
||||
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRootsFromCurrentJre());
|
||||
}
|
||||
|
||||
if (configurationKind.getWithCoroutines()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
|
||||
}
|
||||
if (configurationKind.getWithRuntime()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
|
||||
|
||||
@@ -577,9 +577,6 @@ public class KotlinTestUtils {
|
||||
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRootsFromCurrentJre());
|
||||
}
|
||||
|
||||
if (configurationKind.getWithCoroutines()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.coroutinesJarForTests());
|
||||
}
|
||||
if (configurationKind.getWithRuntime()) {
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests());
|
||||
JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests());
|
||||
|
||||
+1
-1
@@ -530,7 +530,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
compileKotlin(
|
||||
"release.kt",
|
||||
tmpdir,
|
||||
listOf(library, ForTestCompileRuntime.coroutinesJarForTests()),
|
||||
listOf(library),
|
||||
additionalOptions = listOf("-language-version", "1.3", "-api-version", "1.3")
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user