1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>Condition Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2><a name="Condition">Condition</a></h2>
|
---|
12 | <h3>Description</h3>
|
---|
13 | <p>Sets a property if a certain condition holds true - this is a
|
---|
14 | generalization of <a href="available.html">Available</a> and <a
|
---|
15 | href="uptodate.html">Uptodate</a>.</p>
|
---|
16 | <p>If the condition holds true, the property value is set to true by
|
---|
17 | default; otherwise, the property is not set. You can set the value to
|
---|
18 | something other than the default by specifying the <code>value</code>
|
---|
19 | attribute.</p>
|
---|
20 | <p>Conditions are specified as <a href="#nested">nested elements</a>,
|
---|
21 | you must specify exactly one condition.</p>
|
---|
22 | <h3>Parameters</h3>
|
---|
23 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
24 | <tr>
|
---|
25 | <td valign="top"><b>Attribute</b></td>
|
---|
26 | <td valign="top"><b>Description</b></td>
|
---|
27 | <td align="center" valign="top"><b>Required</b></td>
|
---|
28 | </tr>
|
---|
29 | <tr>
|
---|
30 | <td valign="top">property</td>
|
---|
31 | <td valign="top">The name of the property to set.</td>
|
---|
32 | <td valign="top" align="center">Yes</td>
|
---|
33 | </tr>
|
---|
34 | <tr>
|
---|
35 | <td valign="top">value</td>
|
---|
36 | <td valign="top">The value to set the property to. Defaults to
|
---|
37 | "true".</td>
|
---|
38 | <td valign="top" align="center">No</td>
|
---|
39 | </tr>
|
---|
40 | <tr>
|
---|
41 | <td valign="top">else</td>
|
---|
42 | <td valign="top">The value to set the property to if the condition
|
---|
43 | evaluates to <i>false</i>. By default the property will remain unset.
|
---|
44 | <em>Since Ant 1.6.3</em>
|
---|
45 | </td>
|
---|
46 | <td valign="top" align="center">No</td>
|
---|
47 | </tr>
|
---|
48 | </table>
|
---|
49 | <h3><a name="nested">Parameters specified as nested elements</a></h3>
|
---|
50 | <p>All conditions to test are specified as nested elements, for a
|
---|
51 | complete list see <a href="conditions.html">here</a>.</p>
|
---|
52 |
|
---|
53 | <h3>Examples</h3>
|
---|
54 | <pre>
|
---|
55 | <condition property="javamail.complete">
|
---|
56 | <and>
|
---|
57 | <available classname="javax.activation.DataHandler"/>
|
---|
58 | <available classname="javax.mail.Transport"/>
|
---|
59 | </and>
|
---|
60 | </condition>
|
---|
61 | </pre>
|
---|
62 | <p>sets the property <code>javamail.complete</code> if both the
|
---|
63 | JavaBeans Activation Framework and JavaMail are available in the
|
---|
64 | classpath.</p>
|
---|
65 |
|
---|
66 | <pre>
|
---|
67 | <condition property="isMacOsButNotMacOsX">
|
---|
68 | <and>
|
---|
69 | <os family="mac"/>
|
---|
70 |
|
---|
71 | <not>
|
---|
72 | <os family="unix"/>
|
---|
73 |
|
---|
74 | </not>
|
---|
75 | </and>
|
---|
76 | </condition>
|
---|
77 | </pre>
|
---|
78 | <p>sets the property <code>isMacOsButNotMacOsX</code> if the current
|
---|
79 | operating system is MacOS, but not MacOS X - which Ant considers to be
|
---|
80 | in the Unix family as well.</p>
|
---|
81 |
|
---|
82 | <pre>
|
---|
83 | <condition property="isSunOSonSparc">
|
---|
84 | <os name="SunOS" arch="sparc"/>
|
---|
85 |
|
---|
86 | </condition>
|
---|
87 | </pre>
|
---|
88 | <p>sets the property <code>isSunOSonSparc</code> if the current
|
---|
89 | operating system is SunOS and if it is running on a sparc architecture.</p>
|
---|
90 |
|
---|
91 | <hr>
|
---|
92 | <p align="center">Copyright © 2001-2002, 2004-2005 Apache Software
|
---|
93 | Foundation. All rights Reserved.</p>
|
---|
94 |
|
---|
95 | </body>
|
---|
96 | </html>
|
---|