Fix Java6BuiltInsWithJDKMembersTest on Linux

PathUtil.getJdkClassesRoots() takes the path to the JRE. On macOS, this
is the same as the path to the JDK (for Java 6), so the test worked
there. However for OpenJDK on Linux, there's a separate directory named
"jre" in the JDK root. See JavaSdkUtil.getJdkClassesRoots for more
information on how the JDK roots are found
This commit is contained in:
Alexander Udalov
2017-03-30 14:02:18 +03:00
parent b368da8456
commit dc4c8c40bf
@@ -459,7 +459,7 @@ public class KotlinTestUtils {
JvmContentRootsKt.addJvmClasspathRoot(configuration, findAndroidApiJar());
}
else if (jdkKind == TestJdkKind.FULL_JDK_6) {
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRoots(System.getenv("JDK_16")));
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRoots(getJre6Home()));
}
else {
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRoots());
@@ -483,6 +483,15 @@ public class KotlinTestUtils {
return configuration;
}
@NotNull
private static String getJre6Home() {
String home = System.getenv("JDK_16");
if (home == null) throw new AssertionError("Environment variable JDK_16 is not set");
File jre = new File(home, "jre");
return jre.isDirectory() ? jre.getPath() : home;
}
public static void resolveAllKotlinFiles(KotlinCoreEnvironment environment) throws IOException {
List<ContentRoot> paths = environment.getConfiguration().get(JVMConfigurationKeys.CONTENT_ROOTS);
if (paths == null) return;