At first add all sources and only then analyze files
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user