@@ -23,21 +23,21 @@
contain other selectors, and these are called
contain other selectors, and these are called
<a href="#selectcontainers"><code>Selector Containers</code></a>.
<a href="#selectcontainers"><code>Selector Containers</code></a>.
There is also a category of selectors that allow
There is also a category of selectors that allow
user-defined extensions, called
user-defined extensions, called
<a href="#customselect"><code>Custom Selectors</code></a>.
<a href="#customselect"><code>Custom Selectors</code></a>.
The ones built in to Ant are called
The ones built in to Ant are called
<a href="#coreselect"><code>Core Selectors</code></a>.
<a href="#coreselect"><code>Core Selectors</code></a>.
</p>
</p>
<a name="coreselect"></a>
<a name="coreselect"></a>
<h3>Core Selectors</h3>
<h3>Core Selectors</h3>
<p>Core selectors are the ones that come standard
<p>Core selectors are the ones that come standard
with Ant. They can be used within a fileset and can be contained
with Ant. They can be used within a fileset and can be contained
within Selector Containers.</p>
within Selector Containers.</p>
<p>The core selectors are:</p>
<p>The core selectors are:</p>
<ul>
<ul>
<li><a href="#containsselect"><contains></a> - Select
<li><a href="#containsselect"><contains></a> - Select
files that contain a particular text string
files that contain a particular text string
@@ -161,7 +161,7 @@
<h4>Depend Selector</h4>
<h4>Depend Selector</h4>
<p>The <code><depend></code> tag selects files
<p>The <code><depend></code> tag selects files
whose last modified date is later than another, equivalent file in
whose last modified date is later than another, equivalent file in
another location.</p>
another location.</p>
<p>The <code><depend></code> tag supports the use of a
<p>The <code><depend></code> tag supports the use of a
@@ -443,9 +443,13 @@
<li><a href="#orselect"><or></a> - selects a file if any one
<li><a href="#orselect"><or></a> - selects a file if any one
of the contained selectors selects it.
of the contained selectors selects it.
<li><a href="#selectorselect"><selector></a> - contains only one
<li><a href="#selectorselect"><selector></a> - contains only one
selector and forwards all requests to it without alteration. This
selector and forwards all requests to it without alteration, provided
that any <code>"if"</code> or
<code>"unless"</code> conditions are met. This
is the selector to use if you want to define a reference. It is
is the selector to use if you want to define a reference. It is
usable as an element of <code><project></code>.
usable as an element of <code><project></code>. It is also
the one to use if you want selection of files to be dependent on
Ant property settings.
</ul>
</ul>
<p>All selector containers can contain any other selector, including
<p>All selector containers can contain any other selector, including
@@ -618,12 +622,43 @@
<h4>Selector Reference</h4>
<h4>Selector Reference</h4>
<p>The <code><selector></code> tag is used to create selectors
<p>The <code><selector></code> tag is used to create selectors
that can be reused through references. It should be used outside of
that can be reused through references. It is the only selector which can
be used outside of
any target, as an element of the <code><project></code> tag. It
any target, as an element of the <code><project></code> tag. It
can contain only one other selector, but of course that selector can
can contain only one other selector, but of course that selector can
be a container.
be a container.
</p>
</p>
<p>The <code><selector></code> tag can also be used to select
files conditionally based on whether an Ant property exists or not.
This functionality is realized using the <code>"if"</code> and
<code>"unless"</code> attributes in exactly the same way they
are used on targets or on the <code><include></code> and
<code><exclude></code> tags within a
<code><patternset></code>.</p>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">if</td>
<td valign="top">Allow files to be selected only if the named
property is set.
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">unless</td>
<td valign="top">Allow files to be selected only if the named
property is <b>not</b> set.
</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<p>Here is an example of how to use the Selector Reference:</p>
<p>Here is an example of how to use the Selector Reference:</p>
<blockquote><pre>
<blockquote><pre>
@@ -647,7 +682,7 @@
</fileset>
</fileset>
</zip>
</zip>
</target>
</target>
</project>
</project>
</pre></blockquote>
</pre></blockquote>
@@ -655,18 +690,42 @@
class file and javadoc file associated with them.
class file and javadoc file associated with them.
</p>
</p>
<p>And an example of selecting files conditionally, based on whether
properties are set:</p>
<blockquote><pre>
<fileset dir="${working.copy}">
<or>
<selector if="include.tests">
<filename name="**/*Test.class">
</selector>
<selector if="include.source">
<and>
<filename name="**/*.java">
<not>
<selector unless="include.tests">
<filename name="**/*Test.java">
</selector>
</not>
</and>
</selector>
</or>
</fileset>
</pre></blockquote>
<p>A fileset that conditionally contains Java source files and Test
source and class files.</p>
<a name="customselect"></a>
<a name="customselect"></a>
<h3>Custom Selectors</h3>
<h3>Custom Selectors</h3>
<p>You can write your own selectors and use them within the selector
<p>You can write your own selectors and use them within the selector
containers by specifying them within the <custom> tag.</p>
containers by specifying them within the <custom> tag.</p>
<p>First, you have to write your selector class in Java. The only
<p>First, you have to write your selector class in Java. The only
requirement it must meet in order to be a selector is that it implements
requirement it must meet in order to be a selector is that it implements
the <code>org.apache.tools.ant.types.selectors.FileSelector</code>
the <code>org.apache.tools.ant.types.selectors.FileSelector</code>
interface, which contains a single method. See
interface, which contains a single method. See
<a href="selectors-program.html">Programming Selectors in Ant</a> for
<a href="selectors-program.html">Programming Selectors in Ant</a> for
more information.</p>
more information.</p>