From 7e9072ea7018b0aa9eac66d9cf2264b977ba0283 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 1 Apr 2008 21:30:57 +0000 Subject: [PATCH] 221427: optimizing project rebuilds --- tests/multiIncremental/P2/base/I.java | 4 +- tests/multiIncremental/P2/base/J.java | 3 + .../Project1/base/pkgOne/ClassA.java | 6 ++ .../Project1/base/pkgTwo/ClassB.java | 5 ++ .../Project1/inc1/pkgOne/ClassA.java | 6 ++ .../Project1/inc2/pkgTwo/ClassB.java | 7 +++ .../Project1/inc3/pkgOne/ClassA.java | 7 +++ .../Project1/inc4/pkgOne/ClassA.java | 8 +++ .../base/pkgThree/ClassAExtender.java | 5 ++ .../Project2/base/pkgThree/ClassB.java | 3 + .../inc1/pkgThree/ClassAExtenderExtender.java | 5 ++ .../systemtest/ajc160/Ajc160Tests.java | 4 +- .../tools/AjdeInteractionTestbed.java | 1 + .../tools/MultiProjectIncrementalTests.java | 55 ++++++++++++++++++- 14 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 tests/multiIncremental/Project1/base/pkgOne/ClassA.java create mode 100644 tests/multiIncremental/Project1/base/pkgTwo/ClassB.java create mode 100644 tests/multiIncremental/Project1/inc1/pkgOne/ClassA.java create mode 100644 tests/multiIncremental/Project1/inc2/pkgTwo/ClassB.java create mode 100644 tests/multiIncremental/Project1/inc3/pkgOne/ClassA.java create mode 100644 tests/multiIncremental/Project1/inc4/pkgOne/ClassA.java create mode 100644 tests/multiIncremental/Project2/base/pkgThree/ClassAExtender.java create mode 100644 tests/multiIncremental/Project2/base/pkgThree/ClassB.java create mode 100644 tests/multiIncremental/Project2/inc1/pkgThree/ClassAExtenderExtender.java diff --git a/tests/multiIncremental/P2/base/I.java b/tests/multiIncremental/P2/base/I.java index e56b7ef34..81dbdb631 100644 --- a/tests/multiIncremental/P2/base/I.java +++ b/tests/multiIncremental/P2/base/I.java @@ -1 +1,3 @@ -public interface I { } +import pkg.C; + +public interface I { C foo();} diff --git a/tests/multiIncremental/P2/base/J.java b/tests/multiIncremental/P2/base/J.java index 2550f0eec..dac528240 100644 --- a/tests/multiIncremental/P2/base/J.java +++ b/tests/multiIncremental/P2/base/J.java @@ -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 index 000000000..533fa9e7b --- /dev/null +++ b/tests/multiIncremental/Project1/base/pkgOne/ClassA.java @@ -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 index 000000000..4b8d53bae --- /dev/null +++ b/tests/multiIncremental/Project1/base/pkgTwo/ClassB.java @@ -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 index 000000000..88d39334d --- /dev/null +++ b/tests/multiIncremental/Project1/inc1/pkgOne/ClassA.java @@ -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 index 000000000..b80233755 --- /dev/null +++ b/tests/multiIncremental/Project1/inc2/pkgTwo/ClassB.java @@ -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 index 000000000..8fd41f0a8 --- /dev/null +++ b/tests/multiIncremental/Project1/inc3/pkgOne/ClassA.java @@ -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 index 000000000..9c4336a3b --- /dev/null +++ b/tests/multiIncremental/Project1/inc4/pkgOne/ClassA.java @@ -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 index 000000000..e6252c0c7 --- /dev/null +++ b/tests/multiIncremental/Project2/base/pkgThree/ClassAExtender.java @@ -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 index 000000000..0c0cd0c75 --- /dev/null +++ b/tests/multiIncremental/Project2/base/pkgThree/ClassB.java @@ -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 index 000000000..f709aa5fe --- /dev/null +++ b/tests/multiIncremental/Project2/inc1/pkgThree/ClassAExtenderExtender.java @@ -0,0 +1,5 @@ +package pkgThree; + +public class ClassAExtenderExtender extends ClassAExtender { + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java index bffa739ea..5c5fc64e9 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -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"); // } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index f27535a2a..0f12baba3 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -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 diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 9931eced0..ea9d7267f 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -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; -- 2.39.5