From ad88bbb8e0c327d2dd527dbb791e4b4727b628a3 Mon Sep 17 00:00:00 2001 From: Jan Materne Date: Fri, 1 Feb 2008 10:47:14 +0000 Subject: [PATCH] Examples for * * resource selectors git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@617460 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTypes/resources.html | 56 +++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/manual/CoreTypes/resources.html b/docs/manual/CoreTypes/resources.html index 9da66c416..b5f6bf478 100644 --- a/docs/manual/CoreTypes/resources.html +++ b/docs/manual/CoreTypes/resources.html @@ -792,7 +792,38 @@ platforms. Because the resource comparators used (<reverse> and <date>) are in an internal antlib their namespace must be set explicitly. -

+

+ +
+    <project rsel="antlib:org.apache.tools.ant.types.resources.selectors">
+        <macrodef name="copyFromPath">
+            <attribute name="todir"/>
+            <attribute name="refid"/>
+            <element name="nested-resource-selectors" optional="yes" implicit="true"/>
+            <sequential>
+                <mkdir dir="@{todir}" taskname="copyFromPath"/>
+                <copy todir="@{todir}" taskname="copyFromPath">
+                    <restrict>
+                        <path refid="@{refid}"/>
+                        <rsel:or>
+                            <nested-resource-selectors/>
+                        </rsel:or>
+                    </restrict>
+                    <flattenmapper/>
+                </copy>
+            </sequential>
+        </macrodef>
+        <copyFromPath refid="classpath" todir="todir">
+            <rsel:name name="log4j.properties"/>
+            <rsel:name name="default.properties"/>
+        </copyFromPath>
+     </project>
+  
+

Creates the todir directory and copies (if present) the + files log4j.properties and default.properties + from the Classpath (already used while compiling). +

+ @@ -920,6 +951,29 @@ larger collection. Since Ant 1.7.1.

No, default true + +

Example

+
+    <union id="A">
+        <string value="a"/>
+        <string value="b"/>
+    </union>
+    <union id="B">
+        <string value="b"/>
+        <string value="c"/>
+    </union>
+    <union id="union"><resources refid="A"/><resources refid="B"/></union>
+    <intersect id="intersect"><resources refid="A"/><resources refid="B"/></intersect>
+    <difference id="difference"><resources refid="A"/><resources refid="B"/></difference>
+    <echo>
+      A: ${toString:A}                    = a;b
+      B: ${toString:B}                    = b;c
+
+      union     : ${toString:union}       = a;b;c
+      intersect : ${toString:intersect}   = b
+      difference: ${toString:difference}  = a;c
+    </echo>
+