Author: jhm
Date: Fri Feb 1 02:47:14 2008
New Revision: 617460
URL: http://svn.apache.org/viewvc?rev=617460&view=rev
Log:
Examples for
* <union> <intersect> <difference>
* resource selectors
Modified:
ant/core/trunk/docs/manual/CoreTypes/resources.html
Modified: ant/core/trunk/docs/manual/CoreTypes/resources.html
URL:
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTypes/resources.html?rev=617460&r1=617459&r2=617460&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTypes/resources.html (original)
+++ ant/core/trunk/docs/manual/CoreTypes/resources.html Fri Feb 1 02:47:14 2008
@@ -792,7 +792,38 @@
Because the resource comparators used (<code><reverse></code>
and <code><date></code>) are in an internal antlib
their namespace must be set explicitly.
- </p>
+ </p>
+
+ <pre>
+ <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>
+ </pre>
+ <p>Creates the <tt>todir</tt> directory and copies (if present) the
+ files <tt>log4j.properties</tt> and <tt>default.properties</tt>
+ from the Classpath (already used while compiling).
+ </p>
+
</blockquote>
@@ -920,6 +951,29 @@
<td valign="top" align="center">No, default <i>true</i></td>
</tr>
</table>
+
+ <h4>Example</h4>
+ <pre>
+ <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>
+ </pre>
</blockquote>