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