Add kotlin-runtime.jar to the class loader when invoking compiler

TopLevelMembersInvocationTestGenerated failed locally because the compiler
couldn't find runtime classes
This commit is contained in:
Alexander Udalov
2013-10-15 19:10:32 +04:00
parent 65b098b327
commit d5bd8eebff
@@ -79,10 +79,11 @@ public class MockLibraryUtil {
@NotNull
private static Class<?> getCompilerClass() throws MalformedURLException, ClassNotFoundException {
if (compilerClass == null) {
File kotlinCompilerJar = new File(PathUtil.getKotlinPathsForDistDirectory().getLibPath(), "kotlin-compiler.jar");
URLClassLoader classLoader = new URLClassLoader(new URL[] {kotlinCompilerJar.toURI().toURL()}, Object.class.getClassLoader());
File kotlinRuntimeJar = new File(PathUtil.getKotlinPathsForDistDirectory().getLibPath(), "kotlin-runtime.jar");
URLClassLoader classLoader = new URLClassLoader(new URL[] {kotlinCompilerJar.toURI().toURL(), kotlinRuntimeJar.toURI().toURL()},
Object.class.getClassLoader());
compilerClass = classLoader.loadClass(K2JVMCompiler.class.getName());
}