mirror of
https://github.com/apache/ant.git
synced 2025-05-16 13:05:14 +00:00
158 lines
5.5 KiB
HTML
158 lines
5.5 KiB
HTML
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Language" content="en-us">
|
||
|
<title>Ant User Manual</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<h2><a name="Condition">Condition</a></h2>
|
||
|
<h3>Description</h3>
|
||
|
<p>Sets a property if a certain condition holds true - this is a
|
||
|
generalization of <a href="available.html">Available</a> and <a
|
||
|
href="uptodate.html">Uptodate</a>.</p>
|
||
|
<p>If the condition holds true, the property value is set to true by
|
||
|
default; otherwise, the property is not set. You can set the value to
|
||
|
something other than the default by specifying the <code>value</code>
|
||
|
attribute.</p>
|
||
|
<p>Conditions are specified as <a href="#nested">nested elements</a>,
|
||
|
you must specify exactly one condition.</p>
|
||
|
<h3>Parameters</h3>
|
||
|
<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">property</td>
|
||
|
<td valign="top">The name of the property to set.</td>
|
||
|
<td valign="top" align="center">Yes</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">value</td>
|
||
|
<td valign="top">The value to set the property to. Defaults to
|
||
|
"true".</td>
|
||
|
<td valign="top" align="center">No</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<h3><a name="nested">Parameters specified as nested elements</a></h3>
|
||
|
<p>All conditions to test are specified as nested elements.</p>
|
||
|
|
||
|
<h4>not</h4>
|
||
|
<p>The <code><not></code> element expects exactly one other
|
||
|
condition to be nested into this element, negating the result of the
|
||
|
condition. It doesn't have any attributes and accepts all nested
|
||
|
elements of the condition task as nested elements as well.</p>
|
||
|
|
||
|
<h4>and</h4> <p>
|
||
|
The <code><and></code> element doesn't have any attributes and
|
||
|
accepts an arbitrary number of conditions as nested elements - all
|
||
|
nested elements of the condition task are supported. This condition
|
||
|
is true if all of its contained conditions are, conditions will be
|
||
|
evaluated in the order they have been specified in the build file.</p>
|
||
|
<p>The <code><and></code> condition has the same shortcut
|
||
|
semantics as the Java && operator, as soon as one of the
|
||
|
nested conditions is false, no other condition will be evaluated.</p>
|
||
|
|
||
|
<h4>or</h4> <p>
|
||
|
The <code><or></code> element doesn't have any attributes and
|
||
|
accepts an arbitrary number of conditions as nested elements - all
|
||
|
nested elements of the condition task are supported. This condition
|
||
|
is true if at least one of its contained conditions is, conditions
|
||
|
will be evaluated in the order they have been specified in the build
|
||
|
file.</p> <p>The <code><or></code> condition has the same
|
||
|
shortcut semantics as the Java || operator, as soon as one of the
|
||
|
nested conditions is true, no other condition will be evaluated.</p>
|
||
|
|
||
|
<h4>available</h4>
|
||
|
<p>This condition is identical to the <a
|
||
|
href="available.html">Available</a> task, all attributes and nested
|
||
|
elements of that task are supported, the property and value attributes
|
||
|
are redundant and will be ignored.</p>
|
||
|
|
||
|
<h4>uptodate</h4>
|
||
|
<p>This condition is identical to the <a
|
||
|
href="uptodate.html">Uptodate</a> task, all attributes and nested
|
||
|
elements of that task are supported, the property and value attributes
|
||
|
are redundant and will be ignored.</p>
|
||
|
|
||
|
<h4>os</h4>
|
||
|
<p>Test whether the current operating system is of a given type.</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">family</td>
|
||
|
<td valign="top">The name of the operating system family to expect.</td>
|
||
|
<td valign="top" align="center">No</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>Supported values for the family attribute are:
|
||
|
<ul>
|
||
|
<li>windows (for all versions of Microsoft Windows)</li>
|
||
|
<li>dos (for all Microsoft DOS based operating systems including
|
||
|
Microsoft Windows and OS/2)</li>
|
||
|
<li>mac (for all Apple Macintosh systems)</li>
|
||
|
<li>unix (for all Unix and Unix-like operating systems)</li>
|
||
|
</ul>
|
||
|
|
||
|
<h4>equals</h4>
|
||
|
<p>Tests whether the two given Strings are identical</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">arg1</td>
|
||
|
<td valign="top">First string to test.</td>
|
||
|
<td valign="top" align="center">Yes</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">arg2</td>
|
||
|
<td valign="top">Second string to test.</td>
|
||
|
<td valign="top" align="center">Yes</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<h3>Examples</h3>
|
||
|
<pre>
|
||
|
<condition property="javamail.complete">
|
||
|
<and>
|
||
|
<available classname="javax.activation.DataHandler" />
|
||
|
<available classname="javax.mail.Transport" />
|
||
|
</and>
|
||
|
</condition>
|
||
|
</pre>
|
||
|
<p>sets the property <code>javamail.complete</code> if both the
|
||
|
JavaBeans Activation Framework and JavaMail are available in the
|
||
|
classpath.</p>
|
||
|
|
||
|
<pre>
|
||
|
<condition property="isMacOsButNotMacOsX">
|
||
|
<and>
|
||
|
<os family="mac" />
|
||
|
<not>
|
||
|
<os family="unix" />
|
||
|
</not>
|
||
|
</and>
|
||
|
</condition>
|
||
|
</pre>
|
||
|
<p>sets the property <code>isMacOsButNotMacOsX</code> if the current
|
||
|
operating system is MacOS, but not MacOS X - which Ant considers to be
|
||
|
in the Unix family as well.</p>
|
||
|
|
||
|
<hr>
|
||
|
<p align="center">Copyright © 2001 Apache Software
|
||
|
Foundation. All rights Reserved.</p>
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|