public boolean weaveAndGenerateClassFiles() throws IOException {
handler.handleMessage(MessageUtil.info("weaving"));
if (progressListener != null) progressListener.setText("weaving aspects");
+ bcelWeaver.setProgressListener(progressListener, 0.5, 0.5/state.addedClassFiles.size());
//!!! doesn't provide intermediate progress during weaving
// XXX add all aspects even during incremental builds?
addAspectClassFilesToWeaver(state.addedClassFiles);
if (progressListener != null) {
compiledCount++;
progressListener.setProgress((compiledCount/2.0)/sourceFileCount);
+ progressListener.setText("compiled: " + new String(compilationResult.getFileName()));
}
if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IProgressListener;
import org.aspectj.util.FileUtil;
import org.aspectj.weaver.*;
import org.aspectj.weaver.patterns.DeclareParents;
public class BcelWeaver implements IWeaver {
private BcelWorld world;
private CrosscuttingMembersSet xcutSet;
+ private IProgressListener progressListener = null;
+ private double progressMade;
+ private double progressPerClassFile;
public BcelWeaver(BcelWorld world) {
super();
// non-private for testing
LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType) throws IOException {
- return weave(classFile, classType, true);
+ LazyClassGen ret = weave(classFile, classType, true);
+
+ if (progressListener != null) {
+ progressMade += progressPerClassFile;
+ progressListener.setProgress(progressMade);
+ progressListener.setText("woven: " + classFile.getFilename());
+ }
+
+ return ret;
}
- private LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump) throws IOException {
+ private LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump) throws IOException {
if (classType.isSynthetic()) {
if (dump) dumpUnchanged(classFile);
return null;
}
return result;
}
+
+ public void setProgressListener(IProgressListener listener, double previousProgress, double progressPerClassFile) {
+ progressListener = listener;
+ this.progressMade = previousProgress;
+ this.progressPerClassFile = progressPerClassFile;
+ }
+
}