|
|
@@ -4,7 +4,7 @@ |
|
|
|
* under the terms of the Eclipse Public License v1.0 |
|
|
|
* which accompanies this distribution and is available at |
|
|
|
* http://eclipse.org/legal/epl-v10.html |
|
|
|
* |
|
|
|
* |
|
|
|
* Contributors: |
|
|
|
* Andy Clement initial implementation |
|
|
|
* Helen Hawkins Converted to new interface (bug 148190) |
|
|
@@ -57,7 +57,7 @@ import org.aspectj.weaver.World; |
|
|
|
* overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory |
|
|
|
* structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only |
|
|
|
* assumes all builds occur in <sandboxDir>/<projectName>/ ) |
|
|
|
* |
|
|
|
* |
|
|
|
* The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting |
|
|
|
* incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set |
|
|
|
* of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves |
|
|
@@ -106,8 +106,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
checkWasFullBuild(); |
|
|
|
// Should both indicate that Location cannot be resolved |
|
|
|
assertEquals(2,getErrorMessages(p).size()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void testIncrementalITDInners4() throws Exception { |
|
|
|
String p = "prInner4"; |
|
|
|
initialiseProject(p); |
|
|
@@ -174,7 +174,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
* public void testIncrementalAspectWhitespace() throws Exception { AjdeInteractionTestbed.VERBOSE = true; String p = "xxx"; |
|
|
|
* initialiseProject(p); configureNonStandardCompileOptions(p, "-showWeaveInfo"); configureShowWeaveInfoMessages(p, true); |
|
|
|
* build(p); |
|
|
|
* |
|
|
|
* |
|
|
|
* List weaveMessages = getWeavingMessages(p); if (weaveMessages.size() != 0) { for (Iterator iterator = |
|
|
|
* weaveMessages.iterator(); iterator.hasNext();) { Object object = iterator.next(); System.out.println(object); } } |
|
|
|
* checkWasFullBuild(); assertNoErrors(p); alter(p, "inc1"); build(p); checkWasntFullBuild(); assertNoErrors(p); } |
|
|
@@ -681,7 +681,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
String p = "pr278255"; |
|
|
|
initialiseProject(p); |
|
|
|
build(p); |
|
|
|
printModelAndRelationships(p); |
|
|
|
if (AjdeInteractionTestbed.VERBOSE) { |
|
|
|
printModelAndRelationships(p); |
|
|
|
} |
|
|
|
IRelationshipMap irm = getModelFor(p).getRelationshipMap(); |
|
|
|
List<IRelationship> l = irm.get("=pr278255<{A.java'X`declare \\@type"); |
|
|
|
assertNotNull(l); |
|
|
@@ -959,10 +961,10 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
|
|
|
|
/* |
|
|
|
* A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } } |
|
|
|
* |
|
|
|
* |
|
|
|
* C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void |
|
|
|
* method3() { method2(); // line 13 } |
|
|
|
* |
|
|
|
* |
|
|
|
* } |
|
|
|
*/ |
|
|
|
public void testDontLoseAdviceMarkers_pr134471() { |
|
|
@@ -970,14 +972,18 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
// see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; |
|
|
|
initialiseProject("P4"); |
|
|
|
build("P4"); |
|
|
|
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying"); |
|
|
|
if (AjdeInteractionTestbed.VERBOSE) { |
|
|
|
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying"); |
|
|
|
} |
|
|
|
// should be 4 relationship entries |
|
|
|
|
|
|
|
// In inc1 the first advised line is 'commented out' |
|
|
|
alter("P4", "inc1"); |
|
|
|
build("P4"); |
|
|
|
checkWasntFullBuild(); |
|
|
|
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone"); |
|
|
|
if (AjdeInteractionTestbed.VERBOSE) { |
|
|
|
Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone"); |
|
|
|
} |
|
|
|
// should now be 2 relationship entries |
|
|
|
|
|
|
|
// This will be the line 6 entry in C.java |
|
|
@@ -1240,7 +1246,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
/* |
|
|
|
* public void testGenericITD_pr262257() throws IOException { String p = "pr262257"; initialiseProject(p); build(p); |
|
|
|
* checkWasFullBuild(); |
|
|
|
* |
|
|
|
* |
|
|
|
* dumptree(getModelFor(p).getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out); |
|
|
|
* getModelFor(p).dumprels(pw); pw.flush(); } |
|
|
|
*/ |
|
|
@@ -1850,11 +1856,11 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
*/ |
|
|
|
/* |
|
|
|
* public void testProblemCopyingResources_pr138171() { initialiseProject("PR138171"); |
|
|
|
* |
|
|
|
* |
|
|
|
* File f=getProjectRelativePath("PR138171","res.txt"); Map m = new HashMap(); m.put("res.txt",f); |
|
|
|
* AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); build("PR138171"); File f2 = |
|
|
|
* getProjectOutputRelativePath("PR138171","res.txt"); boolean successful = f2.setReadOnly(); |
|
|
|
* |
|
|
|
* |
|
|
|
* alter("PR138171","inc1"); AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); |
|
|
|
* build("PR138171"); List msgs = MyTaskListManager.getErrorMessages(); assertTrue("there should be one message but there are " |
|
|
|
* +(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); IMessage msg = (IMessage)msgs.get(0); String exp = |
|
|
@@ -1906,7 +1912,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
build("P2"); |
|
|
|
checkWasntFullBuild(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testBuildingBrokenCode_pr240360() { |
|
|
|
initialiseProject("pr240360"); |
|
|
|
// configureNonStandardCompileOptions("pr240360","-proceedOnError"); |
|
|
@@ -2361,7 +2367,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
/** |
|
|
|
* The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and <init>(C) ctor |
|
|
|
* to watch out for when checking for structural changes |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
public void testStateManagement3() { |
|
|
|
File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin")); |
|
|
@@ -2386,7 +2392,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
/** |
|
|
|
* The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an |
|
|
|
* instance of C. |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
public void testStateManagement4() { |
|
|
|
File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin")); |
|
|
@@ -2411,7 +2417,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
/** |
|
|
|
* The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will |
|
|
|
* give rise to an accessor being created in C |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
public void testStateManagement5() { |
|
|
|
File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin")); |
|
|
@@ -2959,37 +2965,37 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
* public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true; |
|
|
|
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2"); |
|
|
|
* configureNewProjectDependency("P221427_2","P221427_1"); |
|
|
|
* |
|
|
|
* |
|
|
|
* build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project |
|
|
|
* MyStateListener.reset(); build("P221427_1"); build("P221427_2"); |
|
|
|
* |
|
|
|
* |
|
|
|
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin"))); |
|
|
|
* assertTrue("There should be state for project P221427_1",ajs!=null); |
|
|
|
* //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild(); |
|
|
|
* assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(), |
|
|
|
* ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); |
|
|
|
* |
|
|
|
* |
|
|
|
* } |
|
|
|
* |
|
|
|
* |
|
|
|
* // Case002: changing a class to final that is extended in a dependent project public void |
|
|
|
* testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true; |
|
|
|
* IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4"); |
|
|
|
* configureNewProjectDependency("P221427_4","P221427_3"); |
|
|
|
* |
|
|
|
* |
|
|
|
* build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change |
|
|
|
* class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL, |
|
|
|
* type in super project is now final |
|
|
|
* |
|
|
|
* |
|
|
|
* AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin"))); |
|
|
|
* assertTrue("There should be state for project P221427_3",ajs!=null); |
|
|
|
* System.out.println(MyStateListener.getInstance().getDecisions()); |
|
|
|
* |
|
|
|
* |
|
|
|
* List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0) |
|
|
|
* fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator(); |
|
|
|
* iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } |
|
|
|
* fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ // |
|
|
|
* ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); |
|
|
|
* |
|
|
|
* |
|
|
|
* } |
|
|
|
*/ |
|
|
|
// test for comment #6 - simulates AJDT core builder test testBug99133a - |
|
|
@@ -3553,7 +3559,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
build("PR154054"); |
|
|
|
checkWasntFullBuild(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testIncrementalBuildAdviceChange_456801() throws Exception { |
|
|
|
initialiseProject("456801"); |
|
|
|
build("456801"); |
|
|
@@ -3885,7 +3891,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
/** |
|
|
|
* Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that |
|
|
|
* the 'expected' number are found. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param programElement Program element whose related elements are to be found |
|
|
|
* @param expected the number of expected related elements |
|
|
|
*/ |
|
|
@@ -3936,7 +3942,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa |
|
|
|
} |
|
|
|
} |
|
|
|
List<IProgramElement> kids = ipe.getChildren(); |
|
|
|
for (IProgramElement kid: kids) { |
|
|
|
for (IProgramElement kid: kids) { |
|
|
|
IProgramElement found = findAdvice(kid, whichOne); |
|
|
|
if (found != null) { |
|
|
|
return found; |