diff options
author | aclement <aclement> | 2009-02-12 16:40:08 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-02-12 16:40:08 +0000 |
commit | 41e23851e2f2cb8e1612acc1ad96f57ac60e949c (patch) | |
tree | c8370ae7106416682d5b4e18e23577ec524a795c | |
parent | 1a9817fb980988bf18c86cd8b76a0faec2df015c (diff) | |
download | aspectj-41e23851e2f2cb8e1612acc1ad96f57ac60e949c.tar.gz aspectj-41e23851e2f2cb8e1612acc1ad96f57ac60e949c.zip |
124460: aop.xml used for compilation: AJDT interface support
4 files changed, 83 insertions, 3 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml index 7b984bc58..ee331cc03 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml +++ b/tests/src/org/aspectj/systemtest/ajc164/ajc164.xml @@ -3,7 +3,7 @@ <suite> <ajc-test dir="features164/aopconfig/one" title="aop config - 1"> - <compile files="A.java A2.java B.java foo.xml" options="-1.5 -showWeaveInfo"> + <compile files="A.java A2.java B.java foo.xml" options="-1.5 -showWeaveInfo -xmlConfigured"> <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A' (A.java:2)"/> <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A' (A.java:2)"/> <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> @@ -11,14 +11,14 @@ </ajc-test> <ajc-test dir="features164/aopconfig/one" title="aop config - 2"> - <compile files="A.java A2.java B.java B2.java foo2.xml" options="-1.5 -showWeaveInfo"> + <compile files="A.java A2.java B.java B2.java foo2.xml" options="-1.5 -showWeaveInfo -xmlConfigured"> <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> </compile> </ajc-test> <ajc-test dir="features164/aopconfig/two" title="aop config - 3"> <!-- type pattern in the scope in foo.xml is complete nonsense --> - <compile files="A.java B.java foo.xml" options="-1.5 -Xlint:ignore"> + <compile files="A.java B.java foo.xml" options="-1.5 -Xlint:ignore -xmlConfigured"> <message kind="error" text="Unable to parse scope as type pattern"/> </compile> </ajc-test> diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index f4e4bdc30..b528c36c3 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -71,6 +71,13 @@ public class AjdeInteractionTestbed extends TestCase { ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addProjectSourceFileChanged(changedFile); } + public void addXmlConfigFile(String projectName, String xmlfile) { + List l = new ArrayList(); + l.add(xmlfile); + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProjectXmlConfigFiles(l); + } + public void addClasspathEntry(String projectName, File classpathEntry) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); MultiProjTestCompilerConfiguration config = ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()); @@ -164,6 +171,7 @@ public class AjdeInteractionTestbed extends TestCase { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); resetCompilerRecords(compiler); addSourceFilesToBuild(projectName, compiler); + // addXmlConfigFilesToBuild(projectName, compiler); pause(1000); // delay to allow previous runs build stamps to be OK lognoln("Building project '" + projectName + "'"); compiler.build(); @@ -184,6 +192,7 @@ public class AjdeInteractionTestbed extends TestCase { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); resetCompilerRecords(compiler); addSourceFilesToBuild(projectName, compiler); + addXmlConfigFilesToBuild(projectName, compiler); pause(1000); // delay to allow previous runs build stamps to be OK lognoln("Building project '" + projectName + "'"); compiler.buildFresh(); @@ -226,6 +235,26 @@ public class AjdeInteractionTestbed extends TestCase { } } + private void addXmlConfigFilesToBuild(String pname, AjCompiler compiler) { + File projectBase = new File(sandboxDir, pname); + ICompilerConfiguration icc = compiler.getCompilerConfiguration(); + List currentXmlFiles = icc.getProjectXmlConfigFiles(); + List collector = new ArrayList(); + collectUpXmlFiles(projectBase, projectBase, collector); + boolean changed = false; + for (int i = 0; i < collector.size(); i++) { + if (!currentXmlFiles.contains(collector.get(i))) + changed = true; + } + for (int i = 0; i < currentXmlFiles.size(); i++) { + if (!collector.contains(currentXmlFiles.get(i))) + changed = true; + } + if (changed) { + ((MultiProjTestCompilerConfiguration) icc).setProjectXmlConfigFiles(collector); + } + } + private void collectUpFiles(File location, File base, List collectionPoint) { String contents[] = location.list(); if (contents == null) @@ -250,6 +279,27 @@ public class AjdeInteractionTestbed extends TestCase { } } + private void collectUpXmlFiles(File location, File base, List collectionPoint) { + String contents[] = location.list(); + if (contents == null) + return; + for (int i = 0; i < contents.length; i++) { + String string = contents[i]; + File f = new File(location, string); + if (f.isDirectory()) { + collectUpXmlFiles(f, base, collectionPoint); + } else if (f.isFile() && f.getName().endsWith(".xml")) { + String fileFound; + try { + fileFound = f.getCanonicalPath(); + collectionPoint.add(fileFound); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + /** * Make sure no errors have been recorded */ diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index 192900ae6..cfef1fefe 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -41,6 +41,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio private List modifiedFiles; private List modifiedDirs; private List projectSourceFiles = new ArrayList(); + private List xmlConfigFiles = new ArrayList(); private String projectPath; int changed; @@ -121,6 +122,10 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio return projectSourceFiles; } + public List getProjectXmlConfigFiles() { + return xmlConfigFiles; + } + public List getProjectSourceFilesChanged() { log("ICompilerConfiguration.getProjectSourceFilesChanged()"); return modifiedFiles; @@ -174,6 +179,11 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio this.changed |= ICompilerConfiguration.PROJECTSOURCEFILES_CHANGED; } + public void setProjectXmlConfigFiles(List xmlConfigFiles) { + this.xmlConfigFiles = xmlConfigFiles; + this.changed |= ICompilerConfiguration.XMLCONFIG_CHANGED; + } + public void addProjectSourceFileChanged(File f) { if (this.modifiedFiles == null) { this.modifiedFiles = new ArrayList(); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index f6fe8428d..4282ae5af 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -50,6 +50,26 @@ import org.aspectj.util.FileUtil; */ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + public void testXmlConfiguredProject() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "xmlone"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-showWeaveInfo -xmlConfigured"); + configureShowWeaveInfoMessages(p, true); + addXmlConfigFile(p, getProjectRelativePath(p, "p/aop.xml").toString()); + build(p); + checkWasFullBuild(); + List weaveMessages = getWeavingMessages(p); + if (weaveMessages.size() != 1) { + for (Iterator iterator = weaveMessages.iterator(); iterator.hasNext();) { + Object object = (Object) iterator.next(); + System.out.println(object); + } + fail("Expected just one weave message. The aop.xml should have limited the weaving"); + } + + } + public void testDeclareParentsInModel() { String p = "decps"; initialiseProject(p); |