add runtime to classpath in JetCoreEnvironment
This commit is contained in:
@@ -23,6 +23,7 @@ import org.jetbrains.jet.compiler.CompileEnvironmentException;
|
|||||||
import org.jetbrains.jet.compiler.CompilerPlugin;
|
import org.jetbrains.jet.compiler.CompilerPlugin;
|
||||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||||
|
import org.jetbrains.jet.utils.PathUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -49,11 +50,23 @@ public class BytecodeCompiler {
|
|||||||
* @return compile environment instance
|
* @return compile environment instance
|
||||||
*/
|
*/
|
||||||
private CompileEnvironment env( String stdlib, String[] classpath ) {
|
private CompileEnvironment env( String stdlib, String[] classpath ) {
|
||||||
CompileEnvironment env = new CompileEnvironment(CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR));
|
CompilerSpecialMode compilerSpecialMode = CompilerSpecialMode.REGULAR;
|
||||||
|
File runtimeJar;
|
||||||
if (( stdlib != null ) && ( stdlib.trim().length() > 0 )) {
|
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||||
env.setStdlib( stdlib );
|
if (( stdlib != null ) && ( stdlib.trim().length() > 0 )) {
|
||||||
|
runtimeJar = new File( stdlib );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
runtimeJar = PathUtil.getDefaultRuntimePath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
runtimeJar = null;
|
||||||
|
}
|
||||||
|
CompileEnvironment env = new CompileEnvironment( new CompilerDependencies(
|
||||||
|
compilerSpecialMode,
|
||||||
|
compilerSpecialMode.includeJdkHeaders() ? PathUtil.getAltHeadersPath() : null,
|
||||||
|
runtimeJar ) );
|
||||||
|
|
||||||
if (( classpath != null ) && ( classpath.length > 0 )) {
|
if (( classpath != null ) && ( classpath.length > 0 )) {
|
||||||
env.addToClasspath( classpath );
|
env.addToClasspath( classpath );
|
||||||
|
|||||||
@@ -516,11 +516,6 @@ public class CompileEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStdlib(String stdlib) {
|
|
||||||
File file = new File(stdlib);
|
|
||||||
addToClasspath(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JetCoreEnvironment getEnvironment() {
|
public JetCoreEnvironment getEnvironment() {
|
||||||
return environment;
|
return environment;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compilerSpecialMode.includeKotlinRuntime()) {
|
if (compilerSpecialMode.includeKotlinRuntime()) {
|
||||||
for (VirtualFile root : compilerDependencies.getRuntimeRoots()) {
|
addToClasspath(compilerDependencies.getRuntimeJar());
|
||||||
addLibraryRoot(root);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JetStandardLibrary.initialize(getProject());
|
JetStandardLibrary.initialize(getProject());
|
||||||
|
|||||||
Reference in New Issue
Block a user