Drop "-sourceFiles" in kotlinc-js

Use free arguments instead, as is done in kotlinc-jvm and all sensible
compilers everywhere

Also fix some cases of AntTaskTest to be able to run them locally
This commit is contained in:
Alexander Udalov
2014-07-22 17:16:37 +04:00
parent 125c5e2942
commit 87439b8e0b
14 changed files with 22 additions and 39 deletions
@@ -35,10 +35,6 @@ public class K2JSCompilerArguments extends CommonCompilerArguments {
@ValueDescription("<path[,]>")
public String[] libraryFiles;
@Argument(value = "sourceFiles", description = "Source files or directories separated by commas")
@ValueDescription("<path[,]>")
public String[] sourceFiles;
@Argument(value = "sourcemap", description = "Generate SourceMap")
public boolean sourcemap;
@@ -76,13 +76,13 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
@NotNull MessageCollector messageCollector,
@NotNull Disposable rootDisposable
) {
if (arguments.sourceFiles == null) {
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify sources location via -sourceFiles", NO_LOCATION);
if (arguments.freeArgs.isEmpty()) {
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify at least one source file or directory", NO_LOCATION);
return ExitCode.INTERNAL_ERROR;
}
CompilerConfiguration configuration = new CompilerConfiguration();
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, Arrays.asList(arguments.sourceFiles));
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, arguments.freeArgs);
JetCoreEnvironment environmentForJS = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
Project project = environmentForJS.getProject();