]> source.dussan.org Git - aspectj.git/commitdiff
221427: optimizing project rebuilds
authoraclement <aclement>
Tue, 1 Apr 2008 21:30:57 +0000 (21:30 +0000)
committeraclement <aclement>
Tue, 1 Apr 2008 21:30:57 +0000 (21:30 +0000)
14 files changed:
tests/multiIncremental/P2/base/I.java
tests/multiIncremental/P2/base/J.java
tests/multiIncremental/Project1/base/pkgOne/ClassA.java [new file with mode: 0644]
tests/multiIncremental/Project1/base/pkgTwo/ClassB.java [new file with mode: 0644]
tests/multiIncremental/Project1/inc1/pkgOne/ClassA.java [new file with mode: 0644]
tests/multiIncremental/Project1/inc2/pkgTwo/ClassB.java [new file with mode: 0644]
tests/multiIncremental/Project1/inc3/pkgOne/ClassA.java [new file with mode: 0644]
tests/multiIncremental/Project1/inc4/pkgOne/ClassA.java [new file with mode: 0644]
tests/multiIncremental/Project2/base/pkgThree/ClassAExtender.java [new file with mode: 0644]
tests/multiIncremental/Project2/base/pkgThree/ClassB.java [new file with mode: 0644]
tests/multiIncremental/Project2/inc1/pkgThree/ClassAExtenderExtender.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index e56b7ef346a4ba72967d7d0e70c72f1ecfe0e900..81dbdb631111ee176f87b3d6e3c3d9249c632884 100644 (file)
@@ -1 +1,3 @@
-public interface I { }
+import pkg.C;
+
+public interface I { C foo();}
index 2550f0eecd2d77f827da037eda23f1b9c3d68975..dac52824087870ba09b0cf558c594494c3e0fe71 100644 (file)
@@ -1,2 +1,5 @@
+import pkg.C;
+
 public class J implements I{
+  public C foo() {return null;}
 }
diff --git a/tests/multiIncremental/Project1/base/pkgOne/ClassA.java b/tests/multiIncremental/Project1/base/pkgOne/ClassA.java
new file mode 100644 (file)
index 0000000..533fa9e
--- /dev/null
@@ -0,0 +1,6 @@
+package pkgOne;
+
+public class ClassA {
+    public void mOne() {}
+    public void mTwo() {}
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project1/base/pkgTwo/ClassB.java b/tests/multiIncremental/Project1/base/pkgTwo/ClassB.java
new file mode 100644 (file)
index 0000000..4b8d53b
--- /dev/null
@@ -0,0 +1,5 @@
+package pkgTwo;
+
+public class ClassB {
+    
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project1/inc1/pkgOne/ClassA.java b/tests/multiIncremental/Project1/inc1/pkgOne/ClassA.java
new file mode 100644 (file)
index 0000000..88d3933
--- /dev/null
@@ -0,0 +1,6 @@
+package pkgOne;
+  
+public class ClassA {
+    public void mOne() {}
+    public void mTwo() {}
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project1/inc2/pkgTwo/ClassB.java b/tests/multiIncremental/Project1/inc2/pkgTwo/ClassB.java
new file mode 100644 (file)
index 0000000..b802337
--- /dev/null
@@ -0,0 +1,7 @@
+package pkgTwo;
+
+public class ClassB {
+    public void m() {
+        
+    }
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project1/inc3/pkgOne/ClassA.java b/tests/multiIncremental/Project1/inc3/pkgOne/ClassA.java
new file mode 100644 (file)
index 0000000..8fd41f0
--- /dev/null
@@ -0,0 +1,7 @@
+package pkgOne;
+  
+public class ClassA {
+    public void mOne() {}
+    public void mTwo() {}
+    public void mThree() {}
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project1/inc4/pkgOne/ClassA.java b/tests/multiIncremental/Project1/inc4/pkgOne/ClassA.java
new file mode 100644 (file)
index 0000000..9c4336a
--- /dev/null
@@ -0,0 +1,8 @@
+package pkgOne;
+  
+public class ClassA {
+    public void mOne() {}
+    public void mTwo() {}
+    public void mThree() {}
+    public void mFour() {}
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project2/base/pkgThree/ClassAExtender.java b/tests/multiIncremental/Project2/base/pkgThree/ClassAExtender.java
new file mode 100644 (file)
index 0000000..e6252c0
--- /dev/null
@@ -0,0 +1,5 @@
+package pkgThree;
+
+public class ClassAExtender extends pkgOne.ClassA {
+    
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project2/base/pkgThree/ClassB.java b/tests/multiIncremental/Project2/base/pkgThree/ClassB.java
new file mode 100644 (file)
index 0000000..0c0cd0c
--- /dev/null
@@ -0,0 +1,3 @@
+package pkgThree;
+
+public class ClassB {}
\ No newline at end of file
diff --git a/tests/multiIncremental/Project2/inc1/pkgThree/ClassAExtenderExtender.java b/tests/multiIncremental/Project2/inc1/pkgThree/ClassAExtenderExtender.java
new file mode 100644 (file)
index 0000000..f709aa5
--- /dev/null
@@ -0,0 +1,5 @@
+package pkgThree;
+
+public class ClassAExtenderExtender extends ClassAExtender {
+    
+}
\ No newline at end of file
index bffa739eaee50d8aaabdaeee2135b629ebc2f9f3..5c5fc64e90b43333c6d48daa50f2acf61ef2cc23 100644 (file)
@@ -34,9 +34,9 @@ public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
     public void testLTWITDs_pr223094() {
         runTest("ltw inherited itds");
     }
-  //  public void testBrokenIfArgsCflowAtAj_pr145018() {
+    // public void testBrokenIfArgsCflowAtAj_pr145018() {
     //    runTest("ataj crashing with cflow, if and args");
-   // }
+    // }
     // public void testClassCastOnArrayType_pr180264() {
     // runTest("classcastexception on array type");
     // }
index f27535a2afd30af4e52a5e9549386eae32f68270..0f12baba3689db690f50387f9fd175fd142941c3 100644 (file)
@@ -395,6 +395,7 @@ public class AjdeInteractionTestbed extends TestCase {
 //             public void recordInformation(String s) { decisions.append(s).append("\n");}
                public void recordDecision(String s) {
                        decisions.append(s).append("\n");
+                       log(s);
                }
        };
 }
\ No newline at end of file
index 9931eced03d7ada7b6e14a1f3e651b4c8f4eb5f6..ea9d7267fd4bed48e2e541cae53cbb52b38fdf38 100644 (file)
@@ -520,8 +520,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                checkWasntFullBuild();
                alter("P1","inc3"); // structurally changes one of the classes
                build("P1");
-               build("P2"); // build notices the structural change
-               checkWasFullBuild();
+               build("P2"); // build notices the structural change, but is incremental of I and J as they depend on C
+               checkWasntFullBuild();
                alter("P1","inc4");
                build("P1");
                build("P2"); // build sees a change but works out its not structural
@@ -969,6 +969,57 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                                       // aspect hasn't changed
        }
        
+       public void testIncrementalIntelligence_Scenario01() {
+           AjdeInteractionTestbed.VERBOSE=true;
+           initialiseProject("Project1");
+        initialiseProject("Project2");
+        configureNewProjectDependency("Project2", "Project1");
+        build("Project1");
+        build("Project2");
+        
+        alter("Project1", "inc1"); // white space change to ClassA - no impact
+        build("Project1");
+        build("Project2");
+        checkWasntFullBuild(); // not a structural change so ignored
+
+        alter("Project1", "inc2"); // structural change to ClassB - new method!
+        build("Project1");
+        build("Project2");
+        checkWasntFullBuild(); // not a type that Project2 depends on so ignored
+        
+        alter("Project1", "inc3"); // structural change to ClassA
+        build("Project1");
+        build("Project2");
+        checkWasntFullBuild(); // Just need to recompile ClassAExtender
+        checkCompileWeaveCount("Project2", 1, 1);
+        checkCompiled("Project2", "ClassAExtender");
+        
+        alter("Project2", "inc1"); // New type that depends on ClassAExtender
+        build("Project1");
+        build("Project2");
+        checkWasntFullBuild(); // Just build ClassAExtenderExtender
+        
+        alter("Project1", "inc4"); // another structural change to ClassA
+        build("Project1");
+        build("Project2");
+        checkWasntFullBuild(); // Should rebuild ClassAExtender and ClassAExtenderExtender
+        checkCompileWeaveCount("Project2", 2, 2);
+        checkCompiled("Project2", "ClassAExtenderExtender");
+        
+        
+       }
+       
+       private void checkCompiled(String projectName, String typeNameSubstring) {
+        List files = getCompiledFiles(projectName);
+        boolean found = false;
+        for (Iterator iterator = files.iterator(); iterator.hasNext();) {
+            String object = (String) iterator.next();
+            if (object.indexOf(typeNameSubstring) != -1)
+                found = true;
+        }
+        assertTrue("Did not find '" + typeNameSubstring + "' in list of compiled files", found);
+    }
+       
        // Case001: renaming a private field in a type
 /*     public void testPrReducingDependentBuilds_001_221427() {
                AjdeInteractionTestbed.VERBOSE=true;