}
/**
- * Generate build configuration for the input args, passing to handler any error messages.
+ * Generate build configuration for the input arguments, passing to handler any error messages.
*
* @param args the String[] arguments for the build configuration
* @param setClasspath determines if the classpath should be parsed and set on the build configuration
* @param configFile can be null
- * @return AjBuildConfig per args, which will be invalid unless there are no handler errors.
+ * @return AjBuildConfig per arguments, which will be invalid unless there are no handler errors.
*/
public AjBuildConfig populateBuildConfig(AjBuildConfig buildConfig, String[] args, boolean setClasspath, File configFile) {
Dump.saveCommandLine(args);
buildConfig.setConfigFile(configFile);
try {
- // sets filenames to be non-null in order to make sure that file paramters are ignored
+ // sets filenames to be non-null in order to make sure that file parameters are ignored
super.filenames = new String[] { "" };
AjcConfigParser parser = new AjcConfigParser(buildConfig, handler);
nonaspects.add(units[i]);
}
- if (units == null)
- return; // what does this mean?
-
// ...and put them back together, aspects first
int posn = 0;
for (Iterator iter = aspects.iterator(); iter.hasNext();) {
}
}
ensureWeaverInitialized(); // by doing this only once, are we saying needToReweaveWorld can't change once the aspects have
- // been stuffed into the weaver?
+ // been stuffed into the weaver?
if (weaver.needToReweaveWorld() && !isBatchCompile)
return true;
weaver.weave(new WeaverAdapter(this, weaverMessageHandler, progressListener));
for (int index = 0; index < declaration.annotations.length; index++) {
TypeDeclaration
.resolveAnnotations(declaration.staticInitializerScope, declaration.annotations, declaration.binding); // force
- // annotation
- // resolution
+ // annotation
+ // resolution
Annotation a = declaration.annotations[index];
if (a.resolvedType == null)
continue; // another problem is being reported, so don't crash here
return (String) pipelineOutput.get(key);
}
- private final boolean debugPipeline = false;
+ private final static boolean debugPipeline = false;
public List getResultsPendingWeave() {
return resultsPendingWeave;
private AjCompilerOptions options;
- /** if true, then global values override local when joining */
- private boolean override = true;
-
// incremental variants handled by the compiler client, but parsed here
private boolean incrementalMode;
private File incrementalFile;
}
}
+ /**
+ * Join some global options into a local set of options - globals will override locals.
+ *
+ * @param local
+ * @param global
+ */
void join(Map local, Map global) {
for (Iterator iter = global.keySet().iterator(); iter.hasNext();) {
Object key = iter.next();
- if (override || (null == local.get(key))) { //
- Object value = global.get(key);
- if (null != value) {
- local.put(key, value);
- }
+ // if (override || (null == local.get(key))) { //
+ Object value = global.get(key);
+ if (null != value) {
+ local.put(key, value);
}
+ // }
}
}
}
public boolean batchBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException, AbortException {
- return doBuild(buildConfig, baseHandler, true);
+ return performBuild(buildConfig, baseHandler, true);
}
public boolean incrementalBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException, AbortException {
- return doBuild(buildConfig, baseHandler, false);
+ return performBuild(buildConfig, baseHandler, false);
}
- /** @throws AbortException if check for runtime fails */
- protected boolean doBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler, boolean batch) throws IOException,
+ /**
+ * Perform a build.
+ *
+ * @return true if the build was successful (ie. no errors)
+ */
+ private boolean performBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler, boolean isFullBuild) throws IOException,
AbortException {
boolean ret = true;
- batchCompile = batch;
- wasFullBuild = batch;
+ batchCompile = isFullBuild;
+ wasFullBuild = isFullBuild;
if (baseHandler instanceof ILifecycleAware) {
- ((ILifecycleAware) baseHandler).buildStarting(!batch);
+ ((ILifecycleAware) baseHandler).buildStarting(!isFullBuild);
}
CompilationAndWeavingContext.reset();
- int phase = batch ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD;
+ int phase = isFullBuild ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD;
ContextToken ct = CompilationAndWeavingContext.enteringPhase(phase, buildConfig);
try {
- if (batch) {
+ if (isFullBuild) {
this.state = new AjState(this);
}
this.state.setCouldBeSubsequentIncrementalBuild(this.environmentSupportsIncrementalCompilation);
boolean canIncremental = state.prepareForNextBuild(buildConfig);
- if (!canIncremental && !batch) { // retry as batch?
+ if (!canIncremental && !isFullBuild) { // retry as batch?
CompilationAndWeavingContext.leavingPhase(ct);
if (state.listenerDefined())
state.getListener().recordDecision("Falling back to batch compilation");
- return doBuild(buildConfig, baseHandler, true);
+ return performBuild(buildConfig, baseHandler, true);
}
this.handler = CountingMessageHandler.makeCountingMessageHandler(baseHandler);
// if (batch) {
setBuildConfig(buildConfig);
// }
- if (batch || !AsmManager.attemptIncrementalModelRepairs) {
+ if (isFullBuild || !AsmManager.attemptIncrementalModelRepairs) {
// if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
setupModel(buildConfig);
// }
}
- if (batch) {
+ if (isFullBuild) {
initBcelWorld(handler);
}
+
if (handler.hasErrors()) {
CompilationAndWeavingContext.leavingPhase(ct);
return false;
}
}
- if (batch) {
+ if (isFullBuild) {
// System.err.println("XXXX batch: " + buildConfig.getFiles());
if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
getWorld().setModel(AsmManager.getDefault().getHierarchy());
}
// have to tell state we succeeded or next is not incremental
- state.successfulCompile(buildConfig, batch);
+ state.successfulCompile(buildConfig, isFullBuild);
// For a full compile, copy resources to the destination
// - they should not get deleted on incremental and AJDT
// will handle changes to them that require a recopying
- if (batch) {
+ if (isFullBuild) {
copyResourcesToDestination();
}
} finally {
if (baseHandler instanceof ILifecycleAware) {
- ((ILifecycleAware) baseHandler).buildFinished(!batch);
+ ((ILifecycleAware) baseHandler).buildFinished(!isFullBuild);
}
if (zos != null) {
closeOutputStream(buildConfig.getOutputJar());
/**
* Maintains state needed for incremental compilation
- *
- * tests: two ajdt projects, aspect is changed in dependent, does dependee do a full build? (could just do it if on aspect path but
- * lets just do it for all now)
- *
*/
public class AjState implements CompilerConfigurationChangeFlags {
// coming - otherwise a file that has been deleted from an inpath jar
// since the last build will not be deleted from the output directory.
removeAllResultsOfLastBuild();
- if (stateListener != null)
+ if (stateListener != null) {
stateListener.pathChangeDetected();
+ }
structuralChangesSinceLastFullBuild.clear();
if (listenerDefined())
getListener()
File aDeletedFile = (File) iter.next();
if (this.sourceFilesDefiningAspects.contains(aDeletedFile)) {
removeAllResultsOfLastBuild();
- if (stateListener != null)
+ if (stateListener != null) {
stateListener.detectedAspectDeleted(aDeletedFile);
+ }
return false;
}
List/* ClassFile */classes = (List) fullyQualifiedTypeNamesResultingFromCompilationUnit.get(aDeletedFile);