From 68e346c52831d8d98263ee5e2e197ee1f868a76e Mon Sep 17 00:00:00 2001 From: acolyer Date: Fri, 19 Mar 2004 12:28:19 +0000 Subject: [PATCH] Improvements to incremental compilation of binary source to: 1) Add dependents of changed binary source files 2) Only add changed binary source files in the first compile-loop iteration. --- .../internal/core/builder/AjBuildManager.java | 8 ++--- .../ajdt/internal/core/builder/AjState.java | 31 +++++++++++-------- 2 files changed, 22 insertions(+), 17 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 65dad3eff..0b93dc564 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 @@ -156,7 +156,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc bcelWorld.setModel(AsmManager.getDefault().getHierarchy()); // in incremental build, only get updated model? } - binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(); + binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(true); performCompilation(buildConfig.getFiles()); if (handler.hasErrors()) { return false; @@ -167,17 +167,17 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc // bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel()); // } // System.err.println("XXXX start inc "); + binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(true); List files = state.getFilesToCompile(true); - binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(); - boolean hereWeGoAgain = !(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty()); + boolean hereWeGoAgain = !(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty()); for (int i = 0; (i < 5) && hereWeGoAgain; i++) { // System.err.println("XXXX inc: " + files); performCompilation(files); if (handler.hasErrors() || (progressListener!=null && progressListener.isCancelledRequested())) { return false; } + binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(false); files = state.getFilesToCompile(false); - binarySourcesForTheNextCompile = state.getBinaryFilesToCompile(); hereWeGoAgain = !(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty()); } if (!files.isEmpty()) { diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java index 82dfe6263..9c531df4a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -228,25 +228,30 @@ public class AjState { return thisTime; } - public Map /* String -> List */ getBinaryFilesToCompile() { + public Map /* String -> List */ getBinaryFilesToCompile(boolean firstTime) { if (lastSuccessfulBuildTime == -1 || buildConfig == null) { return binarySourceFiles; } // else incremental... Map toWeave = new HashMap(); - List addedOrModified = new ArrayList(); - addedOrModified.addAll(addedBinaryFiles); - addedOrModified.addAll(getModifiedBinaryFiles()); - for (Iterator iter = addedOrModified.iterator(); iter.hasNext();) { - AjBuildConfig.BinarySourceFile bsf = (AjBuildConfig.BinarySourceFile) iter.next(); - UnwovenClassFile ucf = createUnwovenClassFile(bsf); - if (ucf == null) continue; - List ucfs = new ArrayList(); - ucfs.add(ucf); - binarySourceFiles.put(bsf.binSrc.getPath(),ucfs); - toWeave.put(bsf.binSrc.getPath(),ucfs); + if (firstTime) { + List addedOrModified = new ArrayList(); + addedOrModified.addAll(addedBinaryFiles); + addedOrModified.addAll(getModifiedBinaryFiles()); + for (Iterator iter = addedOrModified.iterator(); iter.hasNext();) { + AjBuildConfig.BinarySourceFile bsf = (AjBuildConfig.BinarySourceFile) iter.next(); + UnwovenClassFile ucf = createUnwovenClassFile(bsf); + if (ucf == null) continue; + List ucfs = new ArrayList(); + ucfs.add(ucf); + addDependentsOf(ucf.getClassName()); + binarySourceFiles.put(bsf.binSrc.getPath(),ucfs); + toWeave.put(bsf.binSrc.getPath(),ucfs); + } + deleteBinaryClassFiles(); + } else { + // return empty set... we've already done our bit. } - deleteBinaryClassFiles(); return toWeave; } -- 2.39.5