add runtime to classpath in JetCoreEnvironment

This commit is contained in:
Stepan Koltsov
2012-04-09 18:22:23 +04:00
parent a41edaa224
commit 59c7f33c88
3 changed files with 18 additions and 12 deletions
@@ -23,6 +23,7 @@ import org.jetbrains.jet.compiler.CompileEnvironmentException;
import org.jetbrains.jet.compiler.CompilerPlugin;
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import org.jetbrains.jet.utils.PathUtil;
import java.io.File;
import java.util.ArrayList;
@@ -49,11 +50,23 @@ public class BytecodeCompiler {
* @return compile environment instance
*/
private CompileEnvironment env( String stdlib, String[] classpath ) {
CompileEnvironment env = new CompileEnvironment(CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR));
if (( stdlib != null ) && ( stdlib.trim().length() > 0 )) {
env.setStdlib( stdlib );
CompilerSpecialMode compilerSpecialMode = CompilerSpecialMode.REGULAR;
File runtimeJar;
if (compilerSpecialMode.includeKotlinRuntime()) {
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 )) {
env.addToClasspath( classpath );