Author: mbenson
Date: Thu Feb 25 04:31:57 2010
New Revision: 916120

URL: http://svn.apache.org/viewvc?rev=916120&view=rev
Log:
Add resource attribute to length task.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/CoreTasks/length.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java
    ant/core/trunk/src/tests/antunit/taskdefs/length-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=916120&r1=916119&r2=916120&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Feb 25 04:31:57 2010
@@ -56,6 +56,8 @@
 
  * Add prefix attribute to loadproperties task.
 
+ * Add resource attribute to length task.
+
 Changes from Ant 1.8.0RC1 TO Ant 1.8.0
 ======================================
 

Modified: ant/core/trunk/docs/manual/CoreTasks/length.html
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/length.html?rev=916120&r1=916119&r2=916120&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/length.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/length.html Thu Feb 25 04:31:57 2010
@@ -47,10 +47,17 @@
   <tr>
     <td valign="top">file</td>
     <td valign="top">Single file whose length to report.</td>
-    <td valign="top" align="center" rowspan="2">One of these,
+    <td valign="top" align="center" rowspan="3">One of these,
       or one or more nested filesets</td>
   </tr>
   <tr>
+    <td valign="top">resource</td>
+    <td valign="top">Single resource whose length to report (using extended
+      <a href="../properties.html#propertyHelper">properties handling</a>).
+      <em>Since Ant 1.8.1</em>
+    </td>
+  </tr>
+  <tr>
     <td valign="top">string</td>
     <td valign="top">The string whose length to report.</td>
   </tr>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java?rev=916120&r1=916119&r2=916120&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java Thu Feb 
25 04:31:57 2010
@@ -68,6 +68,14 @@
     }
 
     /**
+     * Set the single resource for this task.
+     * @param resource the Resource whose length to retrieve.
+     */
+    public synchronized void setResource(Resource resource) {
+        add(resource);
+    }
+
+    /**
      * Set the single file for this task.
      * @param file the <code>File</code> whose length to retrieve.
      */

Modified: ant/core/trunk/src/tests/antunit/taskdefs/length-test.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/length-test.xml?rev=916120&r1=916119&r2=916120&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/length-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/length-test.xml Thu Feb 25 
04:31:57 2010
@@ -230,4 +230,11 @@
     </au:assertTrue>
   </target>
 
+  <target name="testResourceAttribute">
+    <string id="s" value="foo-bar-baz" />
+    <au:assertTrue>
+      <length length="11" resource="${ant.refid:s}" />
+    </au:assertTrue>
+  </target>
+
 </project>


Reply via email to