1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>Condition Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="Condition">Condition</a></h2>
|
---|
28 | <h3>Description</h3>
|
---|
29 | <p>Sets a property if a certain condition holds true - this is a
|
---|
30 | generalization of <a href="available.html">Available</a> and <a
|
---|
31 | href="uptodate.html">Uptodate</a>.</p>
|
---|
32 | <p>If the condition holds true, the property value is set to true by
|
---|
33 | default; otherwise, the property is not set. You can set the value to
|
---|
34 | something other than the default by specifying the <code>value</code>
|
---|
35 | attribute.</p>
|
---|
36 | <p>Conditions are specified as <a href="#nested">nested elements</a>,
|
---|
37 | you must specify exactly one condition.</p>
|
---|
38 | <h3>Parameters</h3>
|
---|
39 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
40 | <tr>
|
---|
41 | <td valign="top"><b>Attribute</b></td>
|
---|
42 | <td valign="top"><b>Description</b></td>
|
---|
43 | <td align="center" valign="top"><b>Required</b></td>
|
---|
44 | </tr>
|
---|
45 | <tr>
|
---|
46 | <td valign="top">property</td>
|
---|
47 | <td valign="top">The name of the property to set.</td>
|
---|
48 | <td valign="top" align="center">Yes</td>
|
---|
49 | </tr>
|
---|
50 | <tr>
|
---|
51 | <td valign="top">value</td>
|
---|
52 | <td valign="top">The value to set the property to. Defaults to
|
---|
53 | "true".</td>
|
---|
54 | <td valign="top" align="center">No</td>
|
---|
55 | </tr>
|
---|
56 | <tr>
|
---|
57 | <td valign="top">else</td>
|
---|
58 | <td valign="top">The value to set the property to if the condition
|
---|
59 | evaluates to <i>false</i>. By default the property will remain unset.
|
---|
60 | <em>Since Ant 1.6.3</em>
|
---|
61 | </td>
|
---|
62 | <td valign="top" align="center">No</td>
|
---|
63 | </tr>
|
---|
64 | </table>
|
---|
65 | <h3><a name="nested">Parameters specified as nested elements</a></h3>
|
---|
66 | <p>All conditions to test are specified as nested elements, for a
|
---|
67 | complete list see <a href="conditions.html">here</a>.</p>
|
---|
68 |
|
---|
69 | <h3>Examples</h3>
|
---|
70 | <pre>
|
---|
71 | <condition property="javamail.complete">
|
---|
72 | <and>
|
---|
73 | <available classname="javax.activation.DataHandler"/>
|
---|
74 | <available classname="javax.mail.Transport"/>
|
---|
75 | </and>
|
---|
76 | </condition>
|
---|
77 | </pre>
|
---|
78 | <p>sets the property <code>javamail.complete</code> if both the
|
---|
79 | JavaBeans Activation Framework and JavaMail are available in the
|
---|
80 | classpath.</p>
|
---|
81 |
|
---|
82 | <pre>
|
---|
83 | <condition property="isMacOsButNotMacOsX">
|
---|
84 | <and>
|
---|
85 | <os family="mac"/>
|
---|
86 |
|
---|
87 | <not>
|
---|
88 | <os family="unix"/>
|
---|
89 |
|
---|
90 | </not>
|
---|
91 | </and>
|
---|
92 | </condition>
|
---|
93 | </pre>
|
---|
94 | <p>sets the property <code>isMacOsButNotMacOsX</code> if the current
|
---|
95 | operating system is MacOS, but not MacOS X - which Ant considers to be
|
---|
96 | in the Unix family as well.</p>
|
---|
97 |
|
---|
98 | <pre>
|
---|
99 | <condition property="isSunOSonSparc">
|
---|
100 | <os name="SunOS" arch="sparc"/>
|
---|
101 |
|
---|
102 | </condition>
|
---|
103 | </pre>
|
---|
104 | <p>sets the property <code>isSunOSonSparc</code> if the current
|
---|
105 | operating system is SunOS and if it is running on a sparc architecture.</p>
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 | </body>
|
---|
110 | </html>
|
---|