At first add all sources and only then analyze files

This commit is contained in:
pTalanov
2012-06-01 16:27:39 +04:00
parent 144fef96cd
commit a5801198d5
@@ -70,11 +70,6 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments, K2JSCompile
}
JetCoreEnvironment environmentForJS = JetCoreEnvironment.getCoreEnvironmentForJS(rootDisposable);
Project project = environmentForJS.getProject();
Config config = getConfig(arguments, project);
if (analyzeAndReportErrors(messageCollector, environmentForJS.getSourceFiles(), config)) {
return ExitCode.COMPILATION_ERROR;
}
if (arguments.srcdir != null) {
environmentForJS.addSources(arguments.srcdir);
@@ -84,6 +79,9 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments, K2JSCompile
environmentForJS.addSources(sourceFile);
}
}
Project project = environmentForJS.getProject();
ClassPathLibrarySourcesLoader sourceLoader = new ClassPathLibrarySourcesLoader(project);
List<JetFile> sourceFiles = sourceLoader.findSourceFiles();
environmentForJS.getSourceFiles().addAll(sourceFiles);
@@ -92,6 +90,11 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments, K2JSCompile
reportCompiledSourcesList(messageCollector, environmentForJS);
}
Config config = getConfig(arguments, project);
if (analyzeAndReportErrors(messageCollector, environmentForJS.getSourceFiles(), config)) {
return ExitCode.COMPILATION_ERROR;
}
String outputFile = arguments.outputFile;
if (outputFile == null) {
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify output file via -output", CompilerMessageLocation.NO_LOCATION);