ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1151369 - in /ant/core/trunk: WHATSNEW manual/Tasks/sync.html src/main/org/apache/tools/ant/taskdefs/Sync.java src/tests/antunit/taskdefs/sync-test.xml
Date Wed, 27 Jul 2011 07:34:46 GMT
Author: bodewig
Date: Wed Jul 27 07:34:45 2011
New Revision: 1151369

URL: http://svn.apache.org/viewvc?rev=1151369&view=rev
Log:
support multiple resource collections in sync.  PR 51462

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/manual/Tasks/sync.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
    ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1151369&r1=1151368&r2=1151369&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Jul 27 07:34:45 2011
@@ -67,6 +67,9 @@ Fixed bugs:
    when Ant is used via its Java API.
    Bugzilla Report 51161
 
+ * <sync> only supported a single non-fileset resource collection even
+   though the manual said it could be multiple.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/manual/Tasks/sync.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/manual/Tasks/sync.html?rev=1151369&r1=1151368&r2=1151369&view=diff
==============================================================================
--- ant/core/trunk/manual/Tasks/sync.html (original)
+++ ant/core/trunk/manual/Tasks/sync.html Wed Jul 27 07:34:45 2011
@@ -98,8 +98,7 @@ dir, it will get removed from the target
 
 <h4>fileset or any other resource collection</h4>
 <p><a href="../Types/resources.html#collection">Resource
-Collection</a>s are used to select groups of files to copy.  To use a
-resource collection, the <code>todir</code> attribute must be set.</p>
+Collection</a>s are used to select groups of files to copy.</p>
 <p>Prior to Ant 1.7 only <code>&lt;fileset&gt;</code> has been
 supported as a nested element.</p>
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java?rev=1151369&r1=1151368&r2=1151369&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java Wed Jul 27 07:34:45 2011
@@ -36,6 +36,7 @@ import org.apache.tools.ant.types.FileSe
 import org.apache.tools.ant.types.PatternSet;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.Resources;
 import org.apache.tools.ant.types.resources.Restrict;
 import org.apache.tools.ant.types.resources.selectors.Exists;
 import org.apache.tools.ant.types.selectors.FileSelector;
@@ -65,6 +66,7 @@ public class Sync extends Task {
     private SyncTarget syncTarget;
 
     private Restrict resources = null;
+    private Resources nestedResources = null;
 
     // Override Task#init
     /**
@@ -401,9 +403,10 @@ public class Sync extends Task {
             if (resources == null) {
                 resources = new Restrict();
                 resources.add(new Exists());
+                resources.add(nestedResources = new Resources());
                 myCopy.add(resources);
             }
-            resources.add(rc);
+            nestedResources.add(rc);
         }
     }
 

Modified: ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml?rev=1151369&r1=1151368&r2=1151369&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml Wed Jul 27 07:34:45 2011
@@ -142,4 +142,13 @@
     <au:assertFileDoesntExist file="${output}/d"/>
   </target>
 
+  <!-- really only tests no exception is thrown -->
+  <target name="testCanAddMultipleResources" depends="setUp"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=51462">
+    <sync todir="${output}">
+      <file file="${input}/x"/>
+      <file file="${input}/y"/>
+    </sync>
+  </target>
+
 </project>



Mime
View raw message