2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-08-09 05:48:49 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Condition Task</title>
|
2001-08-09 05:48:49 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="condition">Condition</h2>
|
2001-08-09 05:48:49 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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 <q>true</q> by default; otherwise, the
|
|
|
|
property is not set. You can set the value to something other than the default by specifying
|
|
|
|
the <var>value</var> attribute.</p>
|
|
|
|
<p>Conditions are specified as <a href="#nested">nested elements</a>, you must specify exactly one
|
|
|
|
condition.</p>
|
2001-08-09 05:48:49 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-08-09 05:48:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-08-09 05:48:49 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>property</td>
|
|
|
|
<td>The name of the property to set.</td>
|
|
|
|
<td>Yes</td>
|
2001-08-09 05:48:49 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>The value to set the property to.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2001-08-09 05:48:49 +00:00
|
|
|
</tr>
|
2005-01-27 21:01:05 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>else</td>
|
|
|
|
<td>The value to set the property to if the condition evaluates to <q>false</q>. <em>Since
|
|
|
|
Apache Ant 1.6.3</em>
|
2005-01-27 21:01:05 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; by default the property will remain unset</td>
|
2005-01-27 21:01:05 +00:00
|
|
|
</tr>
|
2001-08-09 05:48:49 +00:00
|
|
|
</table>
|
2018-01-22 23:52:21 +01:00
|
|
|
<h3 id="nested">Parameters specified as nested elements</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>All conditions to test are specified as nested elements, for a complete list
|
|
|
|
see <a href="conditions.html">here</a>.</p>
|
2001-11-16 12:30:58 +00:00
|
|
|
|
2001-08-09 05:48:49 +00:00
|
|
|
<h3>Examples</h3>
|
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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>
|
2001-08-09 05:48:49 +00:00
|
|
|
|
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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/macOS—which Ant considers to be in the Unix family as well.</p>
|
2001-08-09 05:48:49 +00:00
|
|
|
|
2001-11-25 07:54:28 +00:00
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<condition property="isSunOSonSparc">
|
|
|
|
<os name="SunOS" arch="sparc"/>
|
|
|
|
</condition></pre>
|
|
|
|
<p>sets the property <code>isSunOSonSparc</code> if the current operating system is SunOS and if it
|
|
|
|
is running on a SPARC architecture.</p>
|
2001-11-25 07:54:28 +00:00
|
|
|
|
2001-08-09 05:48:49 +00:00
|
|
|
</body>
|
|
|
|
</html>
|