From: aclement Date: Fri, 28 Jul 2006 10:19:49 +0000 (+0000) Subject: pipeline changes: changed to cope with differing implementations of ICompilerAdapter X-Git-Tag: pre_pr_153572~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b22f23ad786179710eef4541c4beb0e8a193094f;p=aspectj.git pipeline changes: changed to cope with differing implementations of ICompilerAdapter --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java index f108a830b..34c70fda3 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverAdapter.java @@ -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++; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 6e0f844d2..efdefe0d1 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -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); + } } /**