--- /dev/null
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.bridge;
+
+/**
+ * Interface that can be implemented by MessageHandlers that need to
+ * perform some additional processing when a build is starting and
+ * when it has finished.
+ *
+ * @author Adrian Colyer
+ * @since 1.5.1
+ */
+public interface ILifecycleAware {
+
+ /**
+ * called when a build starts
+ */
+ void buildStarting(boolean isIncremental);
+
+ /**
+ * called when a batch build finishes
+ *
+ */
+ void buildFinished(boolean wasIncremental);
+
+}
import org.aspectj.asm.internal.ProgramElement;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.CountingMessageHandler;
+import org.aspectj.bridge.ILifecycleAware;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IProgressListener;
boolean ret = true;
batchCompile = batch;
+ if (baseHandler instanceof ILifecycleAware) {
+ ((ILifecycleAware)baseHandler).buildStarting(!batch);
+ }
int phase = batch ? CompilationAndWeavingContext.BATCH_BUILD : CompilationAndWeavingContext.INCREMENTAL_BUILD;
ContextToken ct = CompilationAndWeavingContext.enteringPhase(phase ,buildConfig);
try {
CompilationAndWeavingContext.leavingPhase(ct);
} finally {
+ if (baseHandler instanceof ILifecycleAware) {
+ ((ILifecycleAware)baseHandler).buildFinished(!batch);
+ }
if (zos != null) {
closeOutputStream(buildConfig.getOutputJar());
}