Reverted all changes related to renaming jdkHeaders to altHeaders.

This commit is contained in:
Evgeny Gerashchenko
2012-05-23 17:05:09 +04:00
parent 393a8a6742
commit ea36cf9fb0
38 changed files with 194 additions and 244 deletions
@@ -20,9 +20,6 @@ import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.intellij.openapi.Disposable;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import jet.modules.Module;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.cli.common.CLICompiler;
@@ -59,26 +56,17 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
protected ExitCode doExecute(K2JVMCompilerArguments arguments, PrintingMessageCollector messageCollector, Disposable rootDisposable) {
CompilerSpecialMode mode = parseCompilerSpecialMode(arguments);
File[] altHeadersClasspath;
if (mode.includeAltHeaders()) {
File path = PathUtil.getAltHeadersPath();
File[] defaultAltHeadersPathArray;
if (path != null) {
defaultAltHeadersPathArray = new File[] {path};
} else {
// TODO should we throw an exception here instead?
defaultAltHeadersPathArray = new File[0];
}
if (arguments.altHeaders != null) {
File[] files = pathsToFiles(arguments.altHeaders);
altHeadersClasspath = ArrayUtil.mergeArrays(files, defaultAltHeadersPathArray);
File jdkHeadersJar;
if (mode.includeJdkHeaders()) {
if (arguments.jdkHeaders != null) {
jdkHeadersJar = new File(arguments.jdkHeaders);
}
else {
altHeadersClasspath = defaultAltHeadersPathArray;
jdkHeadersJar = PathUtil.getAltHeadersPath();
}
}
else {
altHeadersClasspath = new File[0];
jdkHeadersJar = null;
}
File runtimeJar;
@@ -94,7 +82,7 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
runtimeJar = null;
}
CompilerDependencies dependencies = new CompilerDependencies(mode, CompilerDependencies.findRtJar(), altHeadersClasspath, runtimeJar);
CompilerDependencies dependencies = new CompilerDependencies(mode, CompilerDependencies.findRtJar(), jdkHeadersJar, runtimeJar);
JetCoreEnvironment environment = JetCoreEnvironment.getCoreEnvironmentForJVM(rootDisposable, dependencies);
K2JVMCompileEnvironmentConfiguration configuration =
new K2JVMCompileEnvironmentConfiguration(environment, messageCollector);
@@ -153,7 +141,7 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
}
else {
for (CompilerSpecialMode variant : CompilerSpecialMode.values()) {
if (arguments.mode.equalsIgnoreCase(variant.name().replace("_", ""))) {
if (arguments.mode.equalsIgnoreCase(variant.name().replaceAll("_", ""))) {
return variant;
}
}
@@ -196,14 +184,4 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
CompileEnvironmentUtil.addToClasspath(configuration.getEnvironment(), Iterables.toArray(classpath, String.class));
}
}
private static File[] pathsToFiles(String paths) {
return ContainerUtil.map(Iterables.toArray(Splitter.on(File.pathSeparatorChar).split(paths), String.class),
new Function<String, File>() {
@Override
public File fun(String s) {
return new File(s);
}
}, new File[0]);
}
}
@@ -54,10 +54,10 @@ public class K2JVMCompilerArguments extends CompilerArguments {
@Argument(value = "stdlib", description = "Path to the stdlib.jar")
public String stdlib;
@Argument(value = "altHeaders", description = "Path to the alternative library headers paths")
public String altHeaders;
@Argument(value = "jdkHeaders", description = "Path to the kotlin-jdk-headers.jar")
public String jdkHeaders;
@Argument(value = "mode", description = "Special compiler modes: stubs or altHeaders")
@Argument(value = "mode", description = "Special compiler modes: stubs or jdkHeaders")
public String mode;
@Argument(value = "output", description = "output directory")
@@ -86,8 +86,8 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
addToClasspath(compilerDependencies.getJdkJar());
}
if (compilerSpecialMode.includeAltHeaders()) {
for (VirtualFile root : compilerDependencies.getAltHeaderRoots()) {
if (compilerSpecialMode.includeJdkHeaders()) {
for (VirtualFile root : compilerDependencies.getJdkHeaderRoots()) {
addLibraryRoot(root);
}
}