From c017db4d89081fe954e645cc53585cf0df98c2ed Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 24 Mar 2009 00:58:42 +0000 Subject: [PATCH] 268827: ask for the JDT project state --- .../CompilationResultDestinationManager.java | 3 +++ .../ajdt/internal/core/builder/AjState.java | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java index 8eb0e9434..8ea5c2c17 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/CompilationResultDestinationManager.java @@ -75,9 +75,12 @@ public interface CompilationResultDestinationManager { */ void reportFileRemove(String outputfile, int filetype); + int discoverChangesSince(File dir, long buildtime); + // match numbers in IOutputLocationManager - ought to factor into super interface int FILETYPE_UNKNOWN = 0; int FILETYPE_CLASS = 1; int FILETYPE_OUTJAR = 2; int FILETYPE_RESOURCE = 3; + } 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 7c005a045..10bf2a345 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 @@ -432,6 +432,7 @@ public class AjState implements CompilerConfigurationChangeFlags { getListener().recordDecision("Failed to find a state instance managing output location : " + dir); } } + // pr268827 - this guard will cause us to exit quickly if the state says there really is // nothing of interest. This will not catch the case where a user modifies the .class files outside of @@ -443,6 +444,24 @@ public class AjState implements CompilerConfigurationChangeFlags { } return CLASS_FILE_NO_CHANGES; } + + if (state == null) { + // This may be because the directory is the output path of a Java project upon which we depend + // we need to call back into AJDT to ask about that projects state. + CompilationResultDestinationManager crdm = buildConfig.getCompilationResultDestinationManager(); + if (crdm!=null) { + int i = crdm.discoverChangesSince(dir,lastSuccessfulBuildTime); + // 0 = dontknow if it has changed + // 1 = definetly not changed at all + // further numbers can determine more granular changes + if (i==1) { + if (listenerDefined()) { + getListener().recordDecision("'"+dir+"' is apparently unchanged so not performing timestamp check"); + } + return CLASS_FILE_NO_CHANGES; + } + } + } List classFiles = FileUtil.listClassFiles(dir); -- 2.39.5