From: aclement Date: Thu, 12 Feb 2009 16:40:08 +0000 (+0000) Subject: 124460: aop.xml used for compilation: AJDT interface support X-Git-Tag: pre268419~108 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=41e23851e2f2cb8e1612acc1ad96f57ac60e949c;p=aspectj.git 124460: aop.xml used for compilation: AJDT interface support --- 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 @@ - + @@ -11,14 +11,14 @@ - + - + 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);