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:
@@ -79,10 +79,11 @@ public class MockLibraryUtil {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static Class<?> getCompilerClass() throws MalformedURLException, ClassNotFoundException {
|
private static Class<?> getCompilerClass() throws MalformedURLException, ClassNotFoundException {
|
||||||
|
|
||||||
if (compilerClass == null) {
|
if (compilerClass == null) {
|
||||||
File kotlinCompilerJar = new File(PathUtil.getKotlinPathsForDistDirectory().getLibPath(), "kotlin-compiler.jar");
|
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());
|
compilerClass = classLoader.loadClass(K2JVMCompiler.class.getName());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user