List<CompilerError> compilerErrors = new ArrayList<CompilerError>();
INameEnvironment nameEnvironment =
new ClassLoaderNameEnvironment(classLoader, configuration.getSourceLocations());
ICompilerRequestor requestor =
new CompilerRequestor(configuration.getOutputLocation(), configuration.isShowWarnings(), compilerErrors);
Compiler compiler =
new Compiler(nameEnvironment, proceedWithAllProblems(), new CompilerOptions(settings), requestor,
new DefaultProblemFactory(Locale.getDefault()));
// Create compilation units for the source files
List<FileCompilationUnit> compilationUnits = new ArrayList<FileCompilationUnit>();
// Go over the input source locations
List<String> sourceLocations = (List<String>)configuration.getSourceLocations();
for (String sourceLocation : sourceLocations) {
// Exclude nested source locations
List<String> excludeLocations = new ArrayList<String>();
for (String nestedLocation : sourceLocations) {
if (nestedLocation != sourceLocation && nestedLocation.startsWith(sourceLocation)) {
excludeLocations.add(nestedLocation);
}
}
// List source files in each source location
for (String sourceFile : (Set<String>)getSourceFilesForSourceRoot(configuration, sourceLocation)) {
// Exclude files from excluded nested locations
boolean excluded = false;
for (String excludeLocation : excludeLocations) {
if (sourceFile.startsWith(excludeLocation)) {
excluded = true;
}
}
if (!excluded) {
// Create a compilation unit for the source file
FileCompilationUnit compilationUnit =
new FileCompilationUnit(sourceFile, makeClassName(sourceFile, sourceLocation));
compilationUnits.add(compilationUnit);
}
}
}
// Compile all the compilation units
getLogger().info("Compiling " + compilationUnits.size() + " to " + configuration.getOutputLocation());
compiler.compile((ICompilationUnit[])compilationUnits.toArray(new ICompilationUnit[compilationUnits.size()]));
// getLogger().info(configuration.getCustomCompilerArguments().toString());
boolean osgi = "true".equals(configuration.getCustomCompilerArguments().get("-osgi"));
File proj = new File(configuration.getOutputLocation());