From 48c55de75fe35a6381a523101a91d19e4f32e1b9 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Fri, 8 Apr 2011 16:12:30 +0000 Subject: [PATCH] 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 --- WHATSNEW | 3 +++ manual/Tasks/concat.html | 9 +++++++++ .../org/apache/tools/ant/taskdefs/Concat.java | 14 +++++++++++++- .../types/resources/concat-resource-test.xml | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index e1cf6dc1f..315e6968b 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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 =================================== diff --git a/manual/Tasks/concat.html b/manual/Tasks/concat.html index 922bfdb54..ced7eb1e2 100644 --- a/manual/Tasks/concat.html +++ b/manual/Tasks/concat.html @@ -190,6 +190,15 @@ Resource Collections are used to No + + resourcename + + Since Ant 1.8.3 + Specifies the name reported if this task is exposed + as a resource. + + No + diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java index 5c0a626b8..1424e20d6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Concat.java +++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java @@ -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. /** diff --git a/src/tests/antunit/types/resources/concat-resource-test.xml b/src/tests/antunit/types/resources/concat-resource-test.xml index ead945004..554c13d20 100644 --- a/src/tests/antunit/types/resources/concat-resource-test.xml +++ b/src/tests/antunit/types/resources/concat-resource-test.xml @@ -139,4 +139,22 @@ baz + + + + + + + + whatever + + + whatever + + + + + + +