]> source.dussan.org Git - aspectj.git/commitdiff
pipeline changes: changed to cope with differing implementations of ICompilerAdapter
authoraclement <aclement>
Fri, 28 Jul 2006 10:19:49 +0000 (10:19 +0000)
committeraclement <aclement>
Fri, 28 Jul 2006 10:19:49 +0000 (10:19 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java

index f108a830b7dc04b19c4c56494964fd42c80d552e..34c70fda3be4054333f45af9e70d16d5a439b4a2 100644 (file)
@@ -14,6 +14,7 @@ import java.util.Iterator;
 import java.util.Map;
 
 import org.aspectj.bridge.IProgressListener;
+import org.aspectj.bridge.MessageUtil;
 import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
 import org.aspectj.weaver.IClassFileProvider;
 import org.aspectj.weaver.IWeaveRequestor;
@@ -28,7 +29,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
  */
 public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Iterator {
        
-       private AjCompilerAdapter compilerAdapter;
+       private AbstractCompilerAdapter compilerAdapter;
        private Iterator resultIterator;
        private int classFileIndex = 0;
        private InterimCompilationResult nowProcessing;
@@ -46,7 +47,7 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
        private int progressCompletionCount;
 
        
-       public WeaverAdapter(AjCompilerAdapter forCompiler,
+       public WeaverAdapter(AbstractCompilerAdapter forCompiler,
                                                 WeaverMessageHandler weaverMessageHandler,
                                                 IProgressListener progressListener) { 
                this.compilerAdapter = forCompiler;
@@ -62,7 +63,7 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
                localIteratorCounter = 0;
                nowProcessing = null;
                lastReturnedResult = null;
-               resultIterator = compilerAdapter.resultsPendingWeave.iterator();
+               resultIterator = compilerAdapter.getResultsPendingWeave().iterator();
                return this;
        }
        /* (non-Javadoc)
@@ -183,7 +184,8 @@ public class WeaverAdapter implements IClassFileProvider, IWeaveRequestor, Itera
                AjClassFile ajcf = new AjClassFile(className.toCharArray(),
                                                                                   result.getBytes());
                lastReturnedResult.result().record(ajcf.fileName(),ajcf);
-               
+               //System.err.println(progressPhasePrefix+result.getClassName()+" (from "+nowProcessing.fileName()+")");
+               weaverMessageHandler.handleMessage(MessageUtil.info(progressPhasePrefix+result.getClassName()+" (from "+nowProcessing.fileName()+")"));
                if (progressListener != null) {
                        progressCompletionCount++;
                        
index 6e0f844d2372d746cc6c7d39606e1f88785f40c2..efdefe0d172aab6f9023c286c62a6d26e9083f57 100644 (file)
@@ -37,6 +37,7 @@ import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 
 import org.aspectj.ajdt.internal.compiler.AjCompilerAdapter;
+import org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter;
 import org.aspectj.ajdt.internal.compiler.IBinarySourceProvider;
 import org.aspectj.ajdt.internal.compiler.ICompilerAdapter;
 import org.aspectj.ajdt.internal.compiler.ICompilerAdapterFactory;
@@ -949,6 +950,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
                                                }
 
                                        }
+                                       unitResult.compiledTypes.clear(); // free up references to AjClassFile instances
                                }
                                
                                if (unitResult.hasProblems() || unitResult.hasTasks()) {
@@ -1205,18 +1207,33 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
                        new Parser(
                                pr, 
                                forCompiler.options.parseLiteralExpressionsAsConstants);
-               
-               return new AjCompilerAdapter(forCompiler,batchCompile,getBcelWorld(),getWeaver(),
-                                               factory,
-                                               getInterimResultRequestor(),
-                                               progressListener,
-                                               this,  // IOutputFilenameProvider
-                                               this,  // IBinarySourceProvider
-                                               state.getBinarySourceMap(),
-                                               buildConfig.isTerminateAfterCompilation(),
-                                               buildConfig.getProceedOnError(),
-                                               buildConfig.isNoAtAspectJAnnotationProcessing(),
-                                               state);
+               if (getBcelWorld().shouldPipelineCompilation()) {
+                       IMessage message = MessageUtil.info("Pipelining compilation");
+                       handler.handleMessage(message);
+                       return new AjPipeliningCompilerAdapter(forCompiler,batchCompile,getBcelWorld(),getWeaver(),
+                                       factory, 
+                                       getInterimResultRequestor(),
+                                       progressListener,
+                                       this,  // IOutputFilenameProvider
+                                       this,  // IBinarySourceProvider
+                                       state.getBinarySourceMap(),
+                                       buildConfig.isTerminateAfterCompilation(),
+                                       buildConfig.getProceedOnError(),
+                                       buildConfig.isNoAtAspectJAnnotationProcessing(),
+                                       state);
+               } else {
+                       return new AjCompilerAdapter(forCompiler,batchCompile,getBcelWorld(),getWeaver(),
+                                                       factory,
+                                                       getInterimResultRequestor(),
+                                                       progressListener,
+                                                       this,  // IOutputFilenameProvider
+                                                       this,  // IBinarySourceProvider
+                                                       state.getBinarySourceMap(),
+                                                       buildConfig.isTerminateAfterCompilation(),
+                                                       buildConfig.getProceedOnError(),
+                                                       buildConfig.isNoAtAspectJAnnotationProcessing(),
+                                                       state);
+               }
        }
        
        /**