try {
reportProgressBegin();
// record the options passed to the compiler if INFO turned on
if (!msgHandlerAdapter.isIgnoring(IMessage.INFO)) {
handleMessage(new Message(getFormattedOptionsString(), IMessage.INFO, null, null));
}
CompilationAndWeavingContext.reset();
if (fullBuild) { // FULL BUILD
AjBuildConfig buildConfig = generateAjBuildConfig();
if (buildConfig == null) {
return;
}
ajBuildManager.batchBuild(buildConfig, msgHandlerAdapter);
} else { // INCREMENTAL BUILD
// Only rebuild the config object if the configuration has changed
AjBuildConfig buildConfig = null;
ICompilerConfiguration compilerConfig = compiler.getCompilerConfiguration();
int changes = compilerConfig.getConfigurationChanges();
if (changes != ICompilerConfiguration.NO_CHANGES) {
// What configuration changes can we cope with? And besides just repairing the config object
// what does it mean for any existing state that we have?
buildConfig = generateAjBuildConfig();
if (buildConfig == null) {
return;
}
} else {
buildConfig = ajBuildManager.getState().getBuildConfig();
buildConfig.setChanged(changes); // pass it through for the state to use it when making decisions
buildConfig.setModifiedFiles(compilerConfig.getProjectSourceFilesChanged());
buildConfig.setClasspathElementsWithModifiedContents(compilerConfig.getClasspathElementsWithModifiedContents());
compilerConfig.configurationRead();
}
ajBuildManager.incrementalBuild(buildConfig, msgHandlerAdapter);
}
IncrementalStateManager.recordSuccessfulBuild(compiler.getId(), ajBuildManager.getState());
} catch (ConfigParser.ParseException pe) {
handleMessage(new Message("Config file entry invalid, file: " + pe.getFile().getPath() + ", line number: "
+ pe.getLine(), IMessage.WARNING, null, null));
} catch (AbortException e) {
final IMessage message = e.getIMessage();
if (message == null) {
handleMessage(new Message(LangUtil.unqualifiedClassName(e) + " thrown: " + e.getMessage(), IMessage.ERROR, e, null));
} else {
handleMessage(new Message(message.getMessage() + "\n" + CompilationAndWeavingContext.getCurrentContext(),
IMessage.ERROR, e, null));
}
} catch (Throwable t) {
handleMessage(new Message("Compile error: " + LangUtil.unqualifiedClassName(t) + " thrown: " + "" + t.getMessage(),
IMessage.ABORT, t, null));
} finally {
compiler.getBuildProgressMonitor().finish(ajBuildManager.wasFullBuild());
}
}