cli: store unused arguments

This commit is contained in:
Stepan Koltsov
2012-05-22 00:02:56 +04:00
parent ea4a49764d
commit 8623fba01b
5 changed files with 17 additions and 6 deletions
@@ -49,7 +49,7 @@ public abstract class CLICompiler<A extends CompilerArguments, C extends Compile
*/
protected boolean parseArguments(@NotNull PrintStream errStream, @NotNull A arguments, @NotNull String[] args) {
try {
Args.parse(arguments, args);
arguments.freeArgs = Args.parse(arguments, args);
return true;
}
catch (IllegalArgumentException e) {
@@ -41,6 +41,8 @@ public abstract class CompilerArguments {
this.compilerPlugins = compilerPlugins;
}
public List<String> freeArgs;
public abstract boolean isHelp();
public abstract boolean isTags();
public abstract boolean isVersion();
@@ -18,6 +18,7 @@ package org.jetbrains.jet.cli.jvm;
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;
@@ -124,8 +125,13 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
arguments.includeRuntime);
}
else {
List<String> sources = Lists.newArrayList();
if (arguments.src != null) {
sources.add(arguments.src);
}
sources.addAll(arguments.freeArgs);
noErrors = KotlinToJVMBytecodeCompiler.compileBunchOfSources(configuration,
arguments.src, arguments.jar, arguments.outputDir,
sources, arguments.jar, arguments.outputDir,
arguments.includeRuntime);
}
}
@@ -159,8 +159,10 @@ public class KotlinToJVMBytecodeCompiler {
public static boolean compileBunchOfSources(
K2JVMCompileEnvironmentConfiguration configuration,
String sourceFileOrDir, String jar, String outputDir, boolean includeRuntime) {
configuration.getEnvironment().addSources(sourceFileOrDir);
List<String> sourceFilesOrDirs, String jar, String outputDir, boolean includeRuntime) {
for (String sourceFileOrDir : sourceFilesOrDirs) {
configuration.getEnvironment().addSources(sourceFileOrDir);
}
return compileBunchOfSources(configuration, jar, outputDir, includeRuntime);
}