ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1090317 - in /ant/core/trunk: WHATSNEW manual/Tasks/concat.html src/main/org/apache/tools/ant/taskdefs/Concat.java src/tests/antunit/types/resources/concat-resource-test.xml
Date Fri, 08 Apr 2011 16:12:31 GMT
Author: mbenson
Date: Fri Apr  8 16:12:30 2011
New Revision: 1090317

URL: http://svn.apache.org/viewvc?rev=1090317&view=rev
Log:
allow to specify name when using concat as a resource

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/manual/Tasks/concat.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
    ant/core/trunk/src/tests/antunit/types/resources/concat-resource-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1090317&r1=1090316&r2=1090317&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Apr  8 16:12:30 2011
@@ -44,6 +44,9 @@ Other changes:
    documented.
    Bugzilla Report 50576.
 
+ * The concat task now permits the name of its exposed resource
+   by means of its 'resourcename' attribute.
+
 Changes from Ant 1.8.1 TO Ant 1.8.2
 ===================================
 

Modified: ant/core/trunk/manual/Tasks/concat.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/manual/Tasks/concat.html?rev=1090317&r1=1090316&r2=1090317&view=diff
==============================================================================
--- ant/core/trunk/manual/Tasks/concat.html (original)
+++ ant/core/trunk/manual/Tasks/concat.html Fri Apr  8 16:12:30 2011
@@ -190,6 +190,15 @@ Resource Collection</a>s are used to
           </td>
           <td valign="top" align="center">No</td>
         </tr>
+        <tr>
+          <td valign="top">resourcename</td>
+          <td valign="top">
+          <em>Since Ant 1.8.3</em>
+            Specifies the name reported if this task is exposed
+            as a <a href="../Types/resources.html">resource</a>.
+          </td>
+          <td valign="top" align="center">No</td>
+        </tr>
 
       </table>
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java?rev=1090317&r1=1090316&r2=1090317&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java Fri Apr  8 16:12:30
2011
@@ -424,7 +424,8 @@ public class Concat extends Task impleme
                     : new ReaderInputStream(rdr, outputEncoding);
         }
         public String getName() {
-            return "concat (" + String.valueOf(c) + ")";
+            return resourceName == null
+                    ? "concat (" + String.valueOf(c) + ")" : resourceName;
         }
     }
 
@@ -486,6 +487,8 @@ public class Concat extends Task impleme
     /** whether to not create dest if no source files are
      * available */
     private boolean ignoreEmpty = true;
+    /** exposed resource name */
+    private String resourceName;
 
     private ReaderFactory resourceReaderFactory  = new ReaderFactory() {
         public Reader getReader(Object o) throws IOException {
@@ -627,6 +630,15 @@ public class Concat extends Task impleme
         this.ignoreEmpty = ignoreEmpty;
     }
 
+    /**
+     * Set the name that will be reported by the exposed {@link Resource}.
+     * @param resourceName to set
+     * @since Ant 1.8.3
+     */
+    public void setResourceName(String resourceName) {
+        this.resourceName = resourceName;
+    }
+
     // Nested element creators.
 
     /**

Modified: ant/core/trunk/src/tests/antunit/types/resources/concat-resource-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/resources/concat-resource-test.xml?rev=1090317&r1=1090316&r2=1090317&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/resources/concat-resource-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/resources/concat-resource-test.xml Fri Apr  8 16:12:30
2011
@@ -139,4 +139,22 @@ baz
     </au:assertTrue>
   </target>
 
+  <target name="testResourceName">
+    <au:assertTrue>
+      <resourcecount count="1">
+        <restrict>
+          <name name="snicklefritz" />
+          <resources>
+            <concat resourceName="snicklefritz">
+              whatever
+            </concat>
+            <concat>
+              whatever
+            </concat>
+          </resources>
+        </restrict>
+      </resourcecount>
+    </au:assertTrue>
+  </target>
+
 </project>



Mime
View raw message