]> source.dussan.org Git - aspectj.git/commitdiff
Second patch from 95516 (ant support for -outxml) - patch from Matthew
authoraclement <aclement>
Tue, 8 Nov 2005 11:14:45 +0000 (11:14 +0000)
committeraclement <aclement>
Tue, 8 Nov 2005 11:14:45 +0000 (11:14 +0000)
ajde/testsrc/org/aspectj/ajde/OutxmlTest.java
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java

index bde409706a4394e0810a32a8b467f59a8313d964..aba6faf529bb7c915eb2d20612605f1229aed03b 100644 (file)
@@ -70,6 +70,22 @@ public class OutxmlTest extends AjdeTestCase {
                assertTrue(CUSTOM_AOPXML_NAME + " missing",aopxml.exists());
        }
 
+       /**
+        * Aim: Test "-outxml" option produces the correct 
+        * xml entry in outjar file
+        * 
+        */
+       public void testOutxmlToOutjar () {
+               File outjar = openFile(OUTJAR_NAME);
+               ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
+               assertTrue("Build failed",doSynchronousBuild("outxml-to-outjar.lst"));
+               assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
+               
+               File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME);
+               assertFalse(DEFAULT_AOPXML_NAME + " should not exisit",aopxml.exists());
+               assertJarContainsEntry(outjar,DEFAULT_AOPXML_NAME);
+       }
+
        /**
         * Aim: Test "-outxmlfile filename" option produces the correct 
         * xml entry in outjar file
index a64ad2a373b94885d0fe3cac230505417c127495..68d95f594abcaafdc1f6c79a10357e821e11a1b5 100644 (file)
@@ -618,6 +618,14 @@ public class AjcTask extends MatchingTask {
         tmpOutjar = null;
     }
 
+    public void setOutxml(boolean outxml) {
+       cmd.addFlag("-outxml",outxml);
+    }
+
+    public void setOutxmlfile(String name) {
+        cmd.addFlagged("-outxmlfile", name);
+    }
+
     public void setDestdir(File dir) {
         if (null != outjar) {
             String e = "specifying both output jar ("
@@ -1788,6 +1796,10 @@ public class AjcTask extends MatchingTask {
                 setNoExit(true);
             } else if ("-outjar".equals(flag)) {
                 setOutjar(new File(in.next()));
+            } else if ("-outxml".equals(flag)) {
+                setOutxml(true);
+            } else if ("-outxmlfile".equals(flag)) {
+                setOutxmlfile(in.next());
             } else if ("-preserveAllLocals".equals(flag)) {
                 setPreserveAllLocals(true);
             } else if ("-proceedOnError".equals(flag)) {
index fcc27eef126bdc430fc32d3dc697afa4ec86bf8c..7037fa89a660c58011f8283e61f24b07c693b71f 100644 (file)
@@ -710,6 +710,31 @@ public class AjcTaskTest extends TestCase {
                
        }
        
+       public void testOutxml () {
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+               AjcTask task = getTask("showweaveinfo.lst",destDir);
+               task.setOutxml(true);
+               checkRun(task,null);
+               File outxmlFile = new File(destDir,"META-INF/aop.xml");
+               assertTrue("META-INF/aop.xml missing",outxmlFile.exists());
+       }
+       
+       public void testOutxmlFile () {
+               String customName = "custom/aop.xml"; 
+        File destDir = getTempDir();
+        assertTrue(
+            "unable to create " + destDir,
+            destDir.canRead() || destDir.mkdirs());
+               AjcTask task = getTask("showweaveinfo.lst",destDir);
+               task.setOutxmlfile(customName);
+               checkRun(task,null);
+               File outxmlFile = new File(destDir,customName);
+               assertTrue(customName + " missing",outxmlFile.exists());
+       }
+
        protected void runTest(
                AjcTask task,
                Class exceptionType,