diff options
author | wisberg <wisberg> | 2003-04-28 23:22:33 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-04-28 23:22:33 +0000 |
commit | c5175f34dc5c7828d67dec3b790632cccefbe8a6 (patch) | |
tree | 0657f40192e52f05eab27d107f5f56ba6eaea9ab /org.aspectj.ajdt.core | |
parent | 9b30f9f9d9e55ff51dc6c05ee88e00c1d84c8abf (diff) | |
download | aspectj-c5175f34dc5c7828d67dec3b790632cccefbe8a6.tar.gz aspectj-c5175f34dc5c7828d67dec3b790632cccefbe8a6.zip |
Checking in Mik's changes sent by email today for model and incremental support in AJDE.
ajde has the same test failing as it did before this checkin,
perhaps caused by a regression per bug 37020
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java | 28 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmBuilder.java | 25 |
2 files changed, 44 insertions, 9 deletions
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 b9a1ea588..4f2dbb6c5 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 @@ -163,22 +163,38 @@ public class AjBuildManager { //XXX fake incremental public boolean incrementalBuild(AjBuildConfig buildConfig, IMessageHandler baseHandler) throws IOException { +// StructureModelManager.INSTANCE.getStructureModel().getRoot().removeChildren(); + + if (!state.prepareForNextBuild(buildConfig)) { return batchBuild(buildConfig, baseHandler); } + + //!!! too much cut-and-paste from batchBuild this.handler = CountingMessageHandler.makeCountingMessageHandler(baseHandler); + String check = checkRtJar(buildConfig); + if (check != null) { + IMessage message = new Message(check, Message.WARNING, null, null); + // give delegate a chance to implement different message (abort)? + handler.handleMessage(message); + } + try { setBuildConfig(buildConfig); - //setupModel(); + setupModel(); // initBcelWorld(handler); // if (handler.hasErrors()) { // return false; // } + if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { + bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel()); + } + // if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) { // bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel()); // } @@ -186,6 +202,7 @@ public class AjBuildManager { List filesToCompile; while ( !(filesToCompile = state.getFilesToCompile(count == 0)).isEmpty() ) { //if (count > 0) return batchBuild(buildConfig, baseHandler); //??? only 1 try + performCompilation(filesToCompile); if (handler.hasErrors()) return false; @@ -194,12 +211,6 @@ public class AjBuildManager { return batchBuild(buildConfig, baseHandler); } } - - //System.err.println("built in " + count + " cycles"); - -// if (buildConfig.isEmacsSymMode()) { -// new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel(); -// } if (handler.hasErrors()) { return false; @@ -208,10 +219,11 @@ public class AjBuildManager { state.successfulCompile(buildConfig); boolean weaved = weaveAndGenerateClassFiles(); + if (buildConfig.isGenerateModelMode()) { StructureModelManager.INSTANCE.fireModelUpdated(); - } + } return !handler.hasErrors(); } finally { handler = null; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmBuilder.java index b781dfbb8..572744043 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmBuilder.java @@ -64,6 +64,7 @@ public class AsmBuilder extends AbstractSyntaxTreeVisitorAdapter { new AsmBuilder().internalBuild(unit, structureModel); } + private void internalBuild(CompilationUnitDeclaration unit, StructureModel structureModel) { currCompilationResult = unit.compilationResult(); File file = new File(new String(unit.getFileName())); @@ -104,8 +105,30 @@ public class AsmBuilder extends AbstractSyntaxTreeVisitorAdapter { new ArrayList()); StructureModelManager.INSTANCE.getStructureModel().getRoot().addChild(pkgNode); } - pkgNode.addChild(cuNode); + // if the node already exists remove before adding + ProgramElementNode duplicate = null; + for (Iterator itt = pkgNode.getChildren().iterator(); itt.hasNext(); ) { + ProgramElementNode child = (ProgramElementNode)itt.next(); + if (child.getSourceLocation().getSourceFile().equals(file)) { + duplicate = child; + } + } + if (duplicate != null) { + pkgNode.removeChild(duplicate); + } + pkgNode.addChild(cuNode); } else { + // if the node already exists remove before adding + ProgramElementNode duplicate = null; + for (Iterator itt = StructureModelManager.INSTANCE.getStructureModel().getRoot().getChildren().iterator(); itt.hasNext(); ) { + ProgramElementNode child = (ProgramElementNode)itt.next(); + if (child.getSourceLocation().getSourceFile().equals(file)) { + duplicate = child; + } + } + if (duplicate != null) { + StructureModelManager.INSTANCE.getStructureModel().getRoot().removeChild(duplicate); + } StructureModelManager.INSTANCE.getStructureModel().getRoot().addChild(cuNode); } |