Browse Source

allow to specify name when using concat as a resource

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1090317 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 14 years ago
parent
commit
48c55de75f
4 changed files with 43 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +9
    -0
      manual/Tasks/concat.html
  3. +13
    -1
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  4. +18
    -0
      src/tests/antunit/types/resources/concat-resource-test.xml

+ 3
- 0
WHATSNEW View File

@@ -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
===================================



+ 9
- 0
manual/Tasks/concat.html View File

@@ -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>



+ 13
- 1
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -424,7 +424,8 @@ public class Concat extends Task implements ResourceCollection {
: 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 implements ResourceCollection {
/** 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 implements ResourceCollection {
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.

/**


+ 18
- 0
src/tests/antunit/types/resources/concat-resource-test.xml View File

@@ -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>

Loading…
Cancel
Save