From a0355bda0a630db554cbfb25d9a0bb024c3239cb Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 15 Oct 2008 18:39:35 +0000 Subject: [PATCH] 249212: c1: aspectpath change handling --- .../AspectPathOne/inc1/src/Asp2.java | 17 ++++++ .../tools/MultiProjectIncrementalTests.java | 57 ++++++++++++++++++- 2 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 tests/multiIncremental/AspectPathOne/inc1/src/Asp2.java diff --git a/tests/multiIncremental/AspectPathOne/inc1/src/Asp2.java b/tests/multiIncremental/AspectPathOne/inc1/src/Asp2.java new file mode 100644 index 000000000..10df0557a --- /dev/null +++ b/tests/multiIncremental/AspectPathOne/inc1/src/Asp2.java @@ -0,0 +1,17 @@ +public aspect Asp2 { + + +before(): staticinitialization(C*) {} + + + + + + + + + + + + before(): execution(* fo*(..)) {} +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index ed09a5090..1ed8f2669 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -426,13 +426,64 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); build(bug); build(bug2); + dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); + PrintWriter pw = new PrintWriter(System.out); + AsmManager.getDefault().dumprels(pw); + pw.flush(); + IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot(); + assertEquals("=AspectPathTwo/binaries + * Managing the aspectpath is hard. We want to do a minimal build of this project which means recognizing what kind of changes + * have occurred on the aspectpath. Was it a regular class or an aspect? Was it a structural change to that aspect? + *

+ * The filenames for .class files created that contain aspects is stored in the AjState.aspectClassFiles field. When a change is + * detected we can see who was managing the location where the change occurred and ask them if the .class file contained an + * aspect. Right now a change detected like this will cause a full build. We might improve the detection logic here but it isn't + * trivial: + *

+ */ + public void testAspectPath_pr249212_c1() throws IOException { + String p1 = "AspectPathOne"; + String p2 = "AspectPathTwo"; + addSourceFolderForSourceFile(p2, getProjectRelativePath(p2, "src/C.java"), "src"); + initialiseProject(p1); + initialiseProject(p2); + configureAspectPath(p2, getProjectRelativePath(p1, "bin")); + build(p1); + build(p2); + + AjdeInteractionTestbed.VERBOSE = true; + alter(p1, "inc1"); + build(p1); // Modify the aspect Asp2 to include staticinitialization() advice + checkWasFullBuild(); + Set s = AsmManager.getDefault().getModelChangesOnLastBuild(); + assertTrue("Should be empty as was full build:" + s, s.isEmpty()); + + // prod the build of the second project with some extra info to tell it more precisely about the change: + addClasspathEntryChanged(p2, getProjectRelativePath(p1, "bin").toString()); + build(p2); + checkWasFullBuild(); + // dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); // PrintWriter pw = new PrintWriter(System.out); // AsmManager.getDefault().dumprels(pw); // pw.flush(); - IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot(); - assertEquals("=AspectPathTwo/binaries