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-11-30 12:05:27 +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>Conditions Task</title>
|
2001-11-30 12:05:27 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="conditions">Conditions</h2>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Conditions are nested elements of the <a href="condition.html"><code><condition></code></a>
|
|
|
|
and <a href="waitfor.html"><code><waitfor></code></a> tasks. There are core conditions and
|
|
|
|
custom conditions. Custom conditions are described
|
2018-03-08 07:43:53 +01:00
|
|
|
in <a href="../Types/custom-programming.html#customconditions">Custom Conditions</a>. Core
|
2018-02-28 07:58:59 +01:00
|
|
|
Conditions are described below.</p>
|
2018-01-22 23:52:21 +01:00
|
|
|
<h3 id="coreconditions">Core Conditions</h3>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>These are the nested elements that can be used as conditions in
|
|
|
|
the <a href="condition.html"><code><condition></code></a>
|
|
|
|
and <a href="waitfor.html"><code><waitfor></code></a> tasks.</p>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="not">not</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="and">and</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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 <code>&&</code> operator, as soon as one of the nested conditions is false, no other
|
|
|
|
condition will be evaluated.</p>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="or">or</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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 <code>||</code>
|
|
|
|
operator, as soon as one of the nested conditions is true, no other condition will be evaluated.</p>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="xor">xor</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The <code><xor></code> element performs an exclusive or on all nested elements, similar to
|
|
|
|
the <code>^</code> operator in Java. It only evaluates to true if an odd number of nested conditions
|
2005-01-22 22:01:15 +00:00
|
|
|
are true. There is no shortcutting of evaluation, unlike the <code><and></code>
|
2018-02-28 07:58:59 +01:00
|
|
|
and <code><or></code> tests. It doesn't have any attributes and accepts all nested elements
|
|
|
|
of the condition task as nested elements as well.</p>
|
2005-01-22 22:01:15 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="available">available</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="uptodate">uptodate</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<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>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="os">os</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test whether the current operating system is of a given type. Each defined attribute is tested
|
|
|
|
and the result is true only if <em>all</em> the tests succeed.
|
2001-11-30 12:05:27 +00:00
|
|
|
</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-11-30 12:05:27 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>family</td>
|
|
|
|
<td>The name of the operating system family to expect.</td>
|
|
|
|
<td>No</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>name</td>
|
|
|
|
<td>The name of the operating system to expect.</td>
|
|
|
|
<td>No</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>arch</td>
|
|
|
|
<td>The architecture of the operating system to expect.</td>
|
|
|
|
<td>No</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>version</td>
|
|
|
|
<td>The version of the operating system to expect.</td>
|
|
|
|
<td>No</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<p>Supported values for the family attribute are:
|
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>windows</q>—for all versions of Microsoft Windows</li>
|
|
|
|
<li><q>dos</q>—for all Microsoft DOS based operating systems including Microsoft Windows and
|
|
|
|
OS/2</li>
|
|
|
|
<li><q>mac</q>—for all Apple Macintosh systems prior to Mac OS X</li>
|
|
|
|
<li><q>unix</q>—for all Unix(-like) operating systems, including Linux and Mac OS
|
|
|
|
X/macOS</li>
|
|
|
|
<li><q>netware</q>—for Novell NetWare</li>
|
|
|
|
<li><q>os/2</q>—for OS/2</li>
|
|
|
|
<li><q>tandem</q>—for HP's NonStop Kernel, formerly Tandem</li>
|
|
|
|
<li><q>win9x</q>—for Microsoft Windows 95 and 98, ME and CE</li>
|
|
|
|
<li><q>winnt</q>—for Microsoft Windows NT-based systems, including Windows 2000, XP and
|
2005-04-19 22:23:39 +00:00
|
|
|
successors</li>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>z/os</q>—for z/OS and OS/390</li>
|
|
|
|
<li><q>os/400</q>—for OS/400</li>
|
|
|
|
<li><q>openvms</q>—for OpenVMS</li>
|
2001-11-30 12:05:27 +00:00
|
|
|
</ul>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="equals">equals</h4>
|
2010-02-25 21:13:27 +00:00
|
|
|
<p>Tests whether the two given values are equal.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-11-30 12:05:27 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>arg1</td>
|
|
|
|
<td>First value to test.</td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>arg2</td>
|
|
|
|
<td>Second value to test.</td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
2002-01-08 08:52:32 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>casesensitive</td>
|
|
|
|
<td>Perform a case sensitive comparison.</td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2002-01-08 08:52:32 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>trim</td>
|
|
|
|
<td>Trim whitespace from arguments before comparing them.</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2002-01-08 08:52:32 +00:00
|
|
|
</tr>
|
2010-02-25 21:13:27 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>forcestring</td>
|
2018-03-01 06:45:19 +01:00
|
|
|
<td>Force string comparison of <var>arg1</var>/<var>arg2</var>. <em>Since Apache Ant 1.8.1</em>
|
2010-02-25 21:13:27 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; default is <q>false</q></td>
|
2010-02-25 21:13:27 +00:00
|
|
|
</tr>
|
2001-11-30 12:05:27 +00:00
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isset">isset</h4>
|
2001-11-30 12:05:27 +00:00
|
|
|
<p>Test whether a given property has been set in this project.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-11-30 12:05:27 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>property</td>
|
|
|
|
<td>The name of the property to test.</td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="checksum">checksum</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This condition is identical to the <a href="checksum.html">Checksum</a> task, all attributes and
|
|
|
|
nested elements of that task are supported, the property and overwrite attributes are redundant and
|
|
|
|
will be ignored.</p>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="http">http</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The <code>http</code> condition checks for a valid response from a web server of the specified
|
|
|
|
URL. By default, HTTP responses errors of 400 or greater are viewed as invalid.</p>
|
|
|
|
<table class="attr">
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>url</td>
|
|
|
|
<td>The full URL of the page to request. The web server must return a status code below the
|
|
|
|
value of <var>errorsBeginAt</var></td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
2002-07-09 21:06:15 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>errorsBeginAt</td>
|
|
|
|
<td>The lowest HTTP response code that signals an error; server errors, not-authorized,
|
|
|
|
not-found and the like are detected</td>
|
|
|
|
<td>No; default is <q>400</q></td>
|
2002-07-09 21:06:15 +00:00
|
|
|
</tr>
|
2009-07-22 15:17:00 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>requestMethod</td>
|
|
|
|
<td>The HTTP method to be used when issuing the request. Any
|
|
|
|
of <q>GET</q>, <q>POST</q>, <q>HEAD</q>, <q>OPTIONS</q>, <q>PUT</q>, <q>DELETE</q>
|
|
|
|
and <q>TRACE</q> are valid, subject to protocol restrictions.<br/><em>since Ant
|
|
|
|
1.8.0</em></td>
|
|
|
|
<td>No; default is <q>GET</q></td>
|
2009-07-22 15:17:00 +00:00
|
|
|
</tr>
|
2016-02-07 16:02:11 +01:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>followRedirects</td>
|
|
|
|
<td>Whether redirects should be followed.<br/><em>since Ant 1.9.7</em></td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2016-02-07 16:02:11 +01:00
|
|
|
</tr>
|
2019-02-24 09:38:09 +05:30
|
|
|
<tr>
|
|
|
|
<td>readTimeout</td>
|
2019-03-01 22:34:05 +01:00
|
|
|
<td>Read timeout, in milliseconds, that will be used while reading from the target URL.
|
2019-03-02 19:45:31 +05:30
|
|
|
Accepts any value ≥ 0. Value of 0 implies wait indefinitely. Value < 0 will be silently
|
2019-02-24 09:38:09 +05:30
|
|
|
ignored.<br/>
|
|
|
|
<em>since Ant 1.10.6</em></td>
|
|
|
|
<td>No; defaults to <q>0</q></td>
|
|
|
|
</tr>
|
2001-11-30 12:05:27 +00:00
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="socket">socket</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The <code>socket</code> condition checks for the existence of a TCP/IP listener at the specified
|
|
|
|
host and port.</p>
|
|
|
|
<table class="attr">
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>server</td>
|
|
|
|
<td>The DNS name or IP address of the server.</td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>port</td>
|
|
|
|
<td>The port number to connect to.</td>
|
|
|
|
<td>Yes</td>
|
2001-11-30 12:05:27 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="filesmatch">filesmatch</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test two files for matching. Nonexistence of one file results in <q>false</q>, although if
|
|
|
|
neither exists they are considered equal in terms of content. This test does a byte for byte
|
|
|
|
comparison, so test time scales with byte size. <strong>Note</strong>: if the files are different
|
|
|
|
sizes, one of them is missing or the filenames match the answer is so obvious the detailed test is
|
|
|
|
omitted.
|
2002-01-14 00:06:07 +00:00
|
|
|
</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-01-14 00:06:07 +00:00
|
|
|
</tr>
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file1</td>
|
|
|
|
<td>First file to test</td>
|
|
|
|
<td>Yes</td>
|
2002-01-14 00:06:07 +00:00
|
|
|
</tr>
|
2002-02-01 07:24:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file2</td>
|
|
|
|
<td>Second file to test</td>
|
|
|
|
<td>Yes</td>
|
2005-12-23 16:47:09 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>textfile</td>
|
|
|
|
<td>Whether to ignore line endings when comparing files. <em>Since Ant 1.7</em>
|
2005-12-23 16:47:09 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>false</q> which triggers a binary comparison</td>
|
2002-01-14 00:06:07 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="contains">contains</h4>
|
2002-04-19 07:15:44 +00:00
|
|
|
<p>Tests whether a string contains another one.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-02-20 08:36:27 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-02-20 08:36:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>string</td>
|
|
|
|
<td>The string to search in.</td>
|
|
|
|
<td>Yes</td>
|
2002-02-20 08:36:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>substring</td>
|
|
|
|
<td>The string to search for.</td>
|
|
|
|
<td>Yes</td>
|
2002-02-20 08:36:27 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>casesensitive</td>
|
|
|
|
<td>Perform a case sensitive comparison.</td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2002-02-20 08:36:27 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="istrue">istrue</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Tests whether a string equals any of the Ant definitions of true, that
|
|
|
|
is <q>true</q>, <q>yes</q>, or <q>on</q></p>
|
|
|
|
<table class="attr">
|
2002-04-19 07:15:44 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-04-19 07:15:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>value to test</td>
|
|
|
|
<td>Yes</td>
|
2002-04-19 07:15:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<istrue value="${someproperty}"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
<istrue value="false"/></pre>
|
2002-07-09 21:06:15 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isfalse">isfalse</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Tests whether a string is not true, the negation of <code><istrue></code></p>
|
|
|
|
<table class="attr">
|
2002-04-19 07:15:44 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-04-19 07:15:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>value to test</td>
|
|
|
|
<td>Yes</td>
|
2002-04-19 07:15:44 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<isfalse value="${someproperty}"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
<isfalse value="false"/></pre>
|
2002-07-09 21:06:15 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isreference">isreference</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test whether a given reference has been defined in this project and—optionally—is of
|
|
|
|
an expected type.</p>
|
2002-09-09 08:21:39 +00:00
|
|
|
|
2018-01-25 15:14:17 +01:00
|
|
|
<p><em>Since Apache Ant 1.6</em>.</p>
|
2002-09-09 08:21:39 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2002-09-09 08:21:39 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2002-09-09 08:21:39 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>refid</td>
|
|
|
|
<td>The <var>id</var> of the reference to test.</td>
|
|
|
|
<td>Yes</td>
|
2002-09-09 08:21:39 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>type</td>
|
|
|
|
<td>Name of the data type or task this reference is expected to be.</td>
|
|
|
|
<td>No</td>
|
2002-09-09 08:21:39 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2011-05-24 18:41:18 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="issigned">issigned</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test whether a jarfile is signed. If the name of the signature is passed, the file is checked
|
|
|
|
for presence of that particular signature; otherwise the file is checked for the existence of any
|
|
|
|
signature. It does not perform rigorous signature validation; it only looks for the presence of a
|
|
|
|
signature.</p>
|
|
|
|
<p><em>Since Apache Ant 1.7</em>.</p>
|
|
|
|
<table class="attr">
|
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2004-11-26 13:42:43 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td>The jarfile that is to be tested for the presence of a signature.</td>
|
|
|
|
<td>Yes</td>
|
2004-11-26 13:42:43 +00:00
|
|
|
</tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<tr>
|
|
|
|
<td>name</td>
|
|
|
|
<td>The signature name to check for.</td>
|
|
|
|
<td>No</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2011-05-24 18:41:18 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isfileselected">isfileselected</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test whether a file passes an embedded <a href="../Types/selectors.html">selector</a>.</p>
|
|
|
|
<p><em>Since Apache Ant 1.6.3</em>.</p>
|
|
|
|
<table class="attr">
|
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2018-02-28 07:58:59 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>file</td>
|
|
|
|
<td>The file to check if is passes the embedded selector.</td>
|
|
|
|
<td>Yes</td>
|
2004-12-01 11:25:47 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>basedir</td>
|
|
|
|
<td>The base directory to use for name based selectors. It this is not set, the
|
|
|
|
project's <var>basedir</var> will be used.</td>
|
|
|
|
<td>No</td>
|
2004-12-01 11:25:47 +00:00
|
|
|
</tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
</table>
|
|
|
|
<p>Example usage:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<isfileselected file="a.xml">
|
|
|
|
<date datetime="06/28/2000 2:02 pm" when="equal"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</isfileselected></pre>
|
2011-05-24 18:41:18 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="typefound">typefound</h4>
|
2004-01-22 18:02:57 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test whether a given type is defined, and that its implementation class can be loaded. Types
|
|
|
|
include tasks, datatypes, scriptdefs, macrodefs and presetdefs.</p>
|
2004-01-22 18:02:57 +00:00
|
|
|
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Apache Ant 1.7</em>.</p>
|
2004-01-22 18:02:57 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2004-01-22 18:02:57 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2004-01-22 18:02:57 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>name</td>
|
|
|
|
<td>Name of the type</td>
|
|
|
|
<td>Yes</td>
|
2004-01-22 18:02:57 +00:00
|
|
|
</tr>
|
2005-05-20 16:33:15 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>uri</td>
|
|
|
|
<td>The URI that this type lives in.</td>
|
|
|
|
<td>No</td>
|
2005-05-20 16:33:15 +00:00
|
|
|
</tr>
|
2004-01-22 18:02:57 +00:00
|
|
|
</table>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Example usages:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<typefound name="junit"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
<typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/></pre>
|
2005-05-16 14:57:09 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="scriptcondition">scriptcondition</h4>
|
2005-01-17 21:54:34 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Evaluate a condition based on a script in any <a href="https://jakarta.apache.org/bsf"
|
|
|
|
target="_top">Apache BSF</a>
|
2018-03-08 07:43:53 +01:00
|
|
|
or <a href="https://jcp.org/aboutJava/communityprocess/maintenance/jsr223/223ChangeLog.html"
|
|
|
|
target="_top">JSR 223</a> supported language.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>See the <a href="../Tasks/script.html">Script</a> task for an explanation of scripts and
|
|
|
|
dependencies.</p>
|
2005-01-17 21:54:34 +00:00
|
|
|
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Apache Ant 1.7</em>.</p>
|
2005-01-17 21:54:34 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-01-17 21:54:34 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2005-01-17 21:54:34 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>language</td>
|
|
|
|
<td>script language</td>
|
|
|
|
<td>Yes</td>
|
2005-01-17 21:54:34 +00:00
|
|
|
</tr>
|
2006-12-09 15:28:19 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>manager</td>
|
|
|
|
<td>The script engine manager to use. See the <a href="../Tasks/script.html">script</a> task
|
|
|
|
for using this attribute.</td>
|
|
|
|
<td>No; default is <q>auto</q></td>
|
2006-12-09 15:28:19 +00:00
|
|
|
</tr>
|
2005-01-17 21:54:34 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>default boolean value</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2018-01-22 23:52:21 +01:00
|
|
|
</tr>
|
2005-01-17 21:54:34 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>src</td>
|
|
|
|
<td>filename of script source</td>
|
|
|
|
<td>No</td>
|
2006-12-09 15:28:19 +00:00
|
|
|
</tr>
|
Enhanced JavaxScriptRunner, Junit, docs, Javadoc
JavaxScriptRunner:
- Better compiled script reference name to avoid reference name
collision, project wide : execName + ".compiled." +
getScript().hashCode() + "." + getProject().hashCode();
ScriptDef:
- Fixed Javadoc + use of 3rd person
[(oracle style
guideline)](http://www.oracle.com/technetwork/articles/java/index-137868.html#styleguide)
Task manual: documentation for `encoding` and `compiled` options.
- `encoding` : script.html, scriptdef.html, conditions.html,
selectors.html, mapper.html, filterchain.html
- `compiled` : scriptdef.html
Added source file `encoding` option on:
- org.apache.tools.ant.taskdefs.optional.Script
- org.apache.tools.ant.types.optional.AbstractScriptComponent
(inherited by ScriptCondition, ScriptMapper)
- org.apache.tools.ant.types.optional.ScriptFilter
- org.apache.tools.ant.types.optional.ScriptSelector
Test units :
- org.apache.tools.ant.taskdefs.optional.script.ScriptDefTest,
script.xml : src + encoding
- org.apache.tools.ant.taskdefs.optional.RhinoScriptDefTest,
scriptdef.xml : src + encoding, compiled
- new file: src/etc/testcases/taskdefs/optional/script/heavy-script.js
2017-01-20 16:33:35 +01:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>The encoding of the script source. <em>Since Ant 1.10.2</em>.</td>
|
|
|
|
<td>No; defaults to default JVM character encoding</td>
|
Enhanced JavaxScriptRunner, Junit, docs, Javadoc
JavaxScriptRunner:
- Better compiled script reference name to avoid reference name
collision, project wide : execName + ".compiled." +
getScript().hashCode() + "." + getProject().hashCode();
ScriptDef:
- Fixed Javadoc + use of 3rd person
[(oracle style
guideline)](http://www.oracle.com/technetwork/articles/java/index-137868.html#styleguide)
Task manual: documentation for `encoding` and `compiled` options.
- `encoding` : script.html, scriptdef.html, conditions.html,
selectors.html, mapper.html, filterchain.html
- `compiled` : scriptdef.html
Added source file `encoding` option on:
- org.apache.tools.ant.taskdefs.optional.Script
- org.apache.tools.ant.types.optional.AbstractScriptComponent
(inherited by ScriptCondition, ScriptMapper)
- org.apache.tools.ant.types.optional.ScriptFilter
- org.apache.tools.ant.types.optional.ScriptSelector
Test units :
- org.apache.tools.ant.taskdefs.optional.script.ScriptDefTest,
script.xml : src + encoding
- org.apache.tools.ant.taskdefs.optional.RhinoScriptDefTest,
scriptdef.xml : src + encoding, compiled
- new file: src/etc/testcases/taskdefs/optional/script/heavy-script.js
2017-01-20 16:33:35 +01:00
|
|
|
</tr>
|
2006-12-09 15:28:19 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>setbeans</td>
|
|
|
|
<td>whether to have all properties, references and targets as global variables in the
|
|
|
|
script. <em>since Ant 1.8.0</em></td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2006-12-09 15:28:19 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpath</td>
|
|
|
|
<td>The classpath to pass into the script.</td>
|
|
|
|
<td>No</td>
|
2006-12-09 15:28:19 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpathref</td>
|
|
|
|
<td>The classpath to use, given as a <a href="../using.html#references">reference</a> to a path
|
|
|
|
defined elsewhere.</td>
|
|
|
|
<td>No</td>
|
2006-12-09 15:28:19 +00:00
|
|
|
</tr>
|
2005-01-17 21:54:34 +00:00
|
|
|
</table>
|
2006-12-09 15:28:19 +00:00
|
|
|
<h5>Parameters specified as nested elements</h5>
|
|
|
|
<h6>classpath</h6>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>See the <a href="../Tasks/script.html">script</a> task for using this nested element.</p>
|
2006-12-09 15:28:19 +00:00
|
|
|
<h5>Description</h5>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The script supports script language inline, this script has access to the same beans as
|
|
|
|
the <code><script></code> task, and to the <code>self</code> bean, which refers back to the
|
|
|
|
condition itself. If the script evaluates to a boolean result, this is the result of the condition's
|
|
|
|
evaluation (<em>since Ant 1.7.1</em>). Alternatively, <code>self.value</code> can be used to set
|
|
|
|
the evaluation result.</p>
|
|
|
|
<p>Example:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<scriptcondition language="javascript"
|
|
|
|
value="true">
|
|
|
|
self.setValue(false);
|
2018-02-28 07:58:59 +01:00
|
|
|
</scriptcondition></pre>
|
2005-01-17 21:54:34 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Sets the default value of the condition to <q>true</q>, then in the script, sets the value
|
|
|
|
to <q>false</q>. This condition always evaluates to <q>false</q>.</p>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="parsersupports">parsersupports</h4>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Tests whether Ant's XML parser supports a given feature or property, as per the SAX/JAXP
|
|
|
|
specifications, by attempting to set the appropriate property/feature</p>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Apache Ant 1.7</em>.</p>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-02-25 11:32:35 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2005-02-25 11:32:35 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>property</td>
|
|
|
|
<td>property to set</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
2005-02-25 11:32:35 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>feature</td>
|
|
|
|
<td class="left">feature to set</td>
|
2005-02-25 11:32:35 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>string (property) or boolean (feature)</td>
|
|
|
|
<td>For property tests, but not for feature tests</td>
|
2005-02-25 11:32:35 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><parsersupports feature="http://xml.org/sax/features/namespaces"/></pre>
|
|
|
|
<p>Check for namespace support. All SAX2 parsers should have this.</p>
|
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-02-25 11:32:35 +00:00
|
|
|
<or>
|
|
|
|
<parsersupports
|
|
|
|
feature="http://apache.org/xml/features/validation/schema"/>
|
|
|
|
<parsersupports
|
|
|
|
feature="http://java.sun.com/xml/jaxp/properties/schemaSource"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</or></pre>
|
|
|
|
<p>Check for XML Schema support.</p>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2006-09-25 22:06:09 +00:00
|
|
|
<pre>
|
2005-02-25 11:32:35 +00:00
|
|
|
<parsersupports
|
|
|
|
property="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
|
2018-02-28 07:58:59 +01:00
|
|
|
value="document.xsd"/></pre>
|
|
|
|
<p>Check for Xerces-specific definition of the location of the no namespace schema.</p>
|
2005-02-25 11:32:35 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isreachable">isreachable</h4>
|
2005-03-10 14:09:39 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Uses Java 5+ networking APIs to probe for a (remote) system being reachable. Exactly what probe
|
|
|
|
mechanisms are used is an implementation feature of the JVM. They may include ICMP "ping" packets,
|
2019-02-26 08:52:02 +05:30
|
|
|
UDP or TCP connections to port 7 "echo service" or other means.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This condition turns unknown host exceptions into false conditions. This is because on a laptop,
|
|
|
|
DNS is one of the first services when the network goes; you are implicitly offline.</p>
|
|
|
|
<p>If a URL is supplied instead of a <var>host</var>, the hostname is extracted and used in the
|
|
|
|
test—all other parts of the URL are discarded.</p>
|
|
|
|
<p>The test may not work through firewalls, that is, something may be reachable using a protocol
|
|
|
|
such as HTTP, while the lower level ICMP packets get dropped on the floor. Similarly, a host may
|
|
|
|
detected as reachable with ICMP, but not reachable on other ports (i.e. port 80), because of
|
|
|
|
firewalls.</p>
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Apache Ant 1.7</em>.</p>
|
2005-03-10 14:09:39 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-03-10 14:09:39 +00:00
|
|
|
|
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2005-03-10 14:09:39 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>host</td>
|
|
|
|
<td>host to check for</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
2005-03-10 14:09:39 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>url</td>
|
|
|
|
<td class="left">URL containing hostname</td>
|
2005-03-10 14:09:39 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>timeout</td>
|
|
|
|
<td>timeout in seconds</td>
|
|
|
|
<td>No; default is <q>30</q></td>
|
2005-03-10 14:09:39 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-03-10 14:09:39 +00:00
|
|
|
<condition property="offline">
|
2018-02-28 07:58:59 +01:00
|
|
|
<isreachable url="http://ibiblio.org/maven/"/>
|
|
|
|
</condition></pre>
|
2005-03-10 14:09:39 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Probe for the Maven repository being reachable.</p>
|
2005-03-10 14:09:39 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-03-10 14:09:39 +00:00
|
|
|
<condition property="offline">
|
2018-02-28 07:58:59 +01:00
|
|
|
<isreachable host="ibiblio.org" timeout="10"/>
|
|
|
|
</condition></pre>
|
2005-03-10 14:09:39 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Probe for the Maven repository being reachable using the hostname, ten second timeout.</p>
|
2005-04-07 22:22:26 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="length">length</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.6.3</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This condition is a facet of the <a href="length.html">Length</a> task. It is used to test the
|
2018-03-04 15:17:41 +01:00
|
|
|
length of a string or one or more files.</p>
|
2005-04-07 22:22:26 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><length string=" foo " trim="true" length="3"/></pre>
|
2005-05-25 21:50:15 +00:00
|
|
|
<p>Verify a string is of a certain length.</p>
|
2005-04-07 22:22:26 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><length file="foo" when="greater" length="0"/></pre>
|
|
|
|
<p>Verify that file <samp>foo</samp> is not empty.</p>
|
2005-04-07 22:22:26 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="isfailure">isfailure</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test the return code of an executable (see the <a href="exec.html">Exec</a> task) for
|
2018-03-04 15:17:41 +01:00
|
|
|
failure.</p>
|
2005-05-20 22:36:59 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-05-20 22:36:59 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2005-05-20 22:36:59 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>code</td>
|
|
|
|
<td>The return code to test.</td>
|
|
|
|
<td>Yes</td>
|
2005-05-20 22:36:59 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="resourcecount">resourcecount</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This condition is a facet of the <a href="resourcecount.html">ResourceCount</a> task. It is used
|
|
|
|
to test the size of a <a href="../Types/resources.html#collection">resource
|
2018-03-04 15:17:41 +01:00
|
|
|
collection</a>.</p>
|
2005-05-25 21:50:15 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><resourcecount refid="myresourcecollection" when="greater" count="0"/></pre>
|
2005-05-25 21:50:15 +00:00
|
|
|
<p>Verify that a resource collection is not empty.</p>
|
2005-12-23 20:15:49 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="resourcesmatch">resourcesmatch</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Test resources for matching. Nonexistence of one or more resources results in <q>false</q>,
|
|
|
|
although if none exists they are considered equal in terms of content. By default, this test does a
|
|
|
|
byte for byte comparison, so test time scales with byte size. <strong>Note</strong>: if the files
|
|
|
|
are different sizes, one of them is missing or the filenames match the answer is so obvious the
|
|
|
|
detailed test is omitted. The resources to check are specified as
|
|
|
|
nested <a href="../Types/resources.html#collection">resource collections</a>, meaning that more than
|
2018-03-04 15:17:41 +01:00
|
|
|
two resources can be checked; in this case all resources must match.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-12-23 20:15:49 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2005-12-23 20:15:49 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>astext</td>
|
|
|
|
<td>Whether to ignore line endings when comparing resource content; <q>true</q> triggers a
|
|
|
|
binary comparison.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2005-12-23 20:15:49 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="resourcecontains">resourcecontains</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7.1</em></p>
|
2009-01-28 09:53:15 +00:00
|
|
|
<p>Tests whether a resource contains a given (sub)string.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>The resources to check are specified via references or—in the case of file
|
2018-03-10 20:17:33 +01:00
|
|
|
resources—via the <var>resource</var> attribute.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2009-01-28 09:53:15 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2009-01-28 09:53:15 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>resource</td>
|
|
|
|
<td>Name of a file that is the resource to test.</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
2009-01-28 09:53:15 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>refid</td>
|
|
|
|
<td class="left">Reference to a resource defined inside the project.</td>
|
2009-01-28 09:53:15 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>substring</td>
|
|
|
|
<td>The string to search for.</td>
|
|
|
|
<td>Yes</td>
|
2009-01-28 09:53:15 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>casesensitive</td>
|
|
|
|
<td>Perform a case sensitive comparison.</td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2009-01-28 09:53:15 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="hasmethod">hasmethod</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Tests for a class having a method or field. If the class is not found or fails to load, the build
|
2018-03-04 15:17:41 +01:00
|
|
|
fails.</p>
|
2006-07-07 20:46:16 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2018-02-28 07:58:59 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>classname</td>
|
|
|
|
<td>name of the class to load</td>
|
|
|
|
<td>yes</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>field</td>
|
|
|
|
<td>name of a field to look for</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>method</td>
|
|
|
|
<td class="left">name of a method to look for</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>ignoreSystemClasses</td>
|
|
|
|
<td>should system classes be ignored?</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>classpath</td>
|
|
|
|
<td>a class path</td>
|
|
|
|
<td>No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>classpathref</td>
|
|
|
|
<td>reference to a class path</td>
|
|
|
|
<td>No</td>
|
|
|
|
</tr>
|
2006-07-07 20:46:16 +00:00
|
|
|
</table>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>There is also a nested <code><classpath></code> element, which can be used to specify a
|
|
|
|
classpath.</p>
|
|
|
|
<pre><hasmethod classname="java.util.ArrayList" method="trimToSize"/></pre>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p>Looks for the method <code class="code">trimToSize()</code> in
|
|
|
|
the <code class="code">java.util.ArrayList</code> class.</p>
|
2006-07-07 20:46:16 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="matches">matches</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7</em></p>
|
|
|
|
<p>Test if the specified string matches the specified regular expression pattern</p>
|
2006-09-11 20:22:51 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2006-09-25 21:39:08 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>string</td>
|
|
|
|
<td>The string to test.</td>
|
|
|
|
<td>Yes</td>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>pattern</td>
|
|
|
|
<td>The regular expression pattern used to test.</td>
|
2018-03-01 23:14:03 +01:00
|
|
|
<td>Yes, unless there is a nested <code><regexp></code> element</td>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>casesensitive</td>
|
|
|
|
<td>Perform a case sensitive match.</td>
|
|
|
|
<td>No; default is <q>true</q></td>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>multiline</td>
|
|
|
|
<td>Perform a multi line match.</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>singleline</td>
|
|
|
|
<td>This allows <q>.</q> to match new lines. <var>SingleLine</var> is not to be confused with
|
|
|
|
multiline, <var>SingleLine</var> is a perl regex term, it corresponds to <var>dotall</var> in
|
|
|
|
Java regex.</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2006-09-25 21:39:08 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2001-11-30 12:05:27 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>There is also an optional <code><regexp></code> element, which can be used to specify a
|
|
|
|
regular expression instead of the <var>pattern</var> attribute.
|
|
|
|
See <a href="../Types/regexp.html">Regexp Type</a> for the description of the nested element regexp
|
|
|
|
and of the choice of regular expression implementation.</p>
|
|
|
|
<p>An example:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-11-13 20:48:56 +00:00
|
|
|
<condition property="legal-password">
|
2006-09-25 21:39:08 +00:00
|
|
|
<matches pattern="[1-9]" string="${user-input}"/>
|
|
|
|
</condition>
|
|
|
|
<fail message="Your password should at least contain one number"
|
2018-02-28 07:58:59 +01:00
|
|
|
unless="legal-password"/></pre>
|
|
|
|
<p>The following example sets the property <code>ok</code> if the property <code>input</code> is
|
|
|
|
three characters long, starting with <q>a</q> and ending with <q>b</q>.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<condition property="ok">
|
|
|
|
<matches string="${input}" pattern="^a.b$"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</condition></pre>
|
|
|
|
<p>The following defines a reference regular expression for matching dates and then uses antunit to
|
|
|
|
check if the property <code>today</code> is in the correct format:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<regexp id="date.pattern" pattern="^[0123]\d-[01]\d-[12]\d\d\d$"/>
|
|
|
|
|
|
|
|
<au:assertTrue xmlns:au="antlib:org.apache.ant.antunit">
|
|
|
|
<matches string="${today}">
|
|
|
|
<regexp refid="date.pattern"/>
|
|
|
|
</matches>
|
2018-02-28 07:58:59 +01:00
|
|
|
</au:assertTrue></pre>
|
|
|
|
<p>The following example shows the use of the <var>singleline</var> and the <var>casesensitive</var>
|
|
|
|
flags.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2006-09-25 21:39:08 +00:00
|
|
|
<au:assertTrue>
|
|
|
|
<matches string="AB${line.separator}C" pattern="^ab.*C$"
|
|
|
|
casesensitive="false"
|
|
|
|
singleline="true"/>
|
|
|
|
</au:assertTrue>
|
|
|
|
<au:assertFalse>
|
|
|
|
<matches string="AB${line.separator}C" pattern="^ab.*C$"
|
|
|
|
casesensitive="false"
|
|
|
|
singleline="false"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</au:assertFalse></pre>
|
2011-05-24 18:41:18 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="antversion">antversion</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This condition is identical to the <a href="antversion.html">Antversion</a> task, all attributes
|
|
|
|
are supported, the <var>property</var> attribute is redundant and will be ignored.</p>
|
2006-11-13 20:48:56 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="hasfreespace">hasfreespace</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.7.0</em></p>
|
|
|
|
<p>Tests a partition to see if there is enough space.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Needed attribute can be specified using standard computing terms:</p>
|
|
|
|
<ul>
|
|
|
|
<li>K : Kilobytes (1024 bytes)</li>
|
|
|
|
<li>M : Megabytes (1024 K)</li>
|
|
|
|
<li>G : Gigabytes (1024 M)</li>
|
|
|
|
<li>T : Terabytes (1024 G)</li>
|
|
|
|
<li>P : Petabytes (1024 T)</li>
|
|
|
|
</ul>
|
2007-01-03 10:51:08 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2007-01-03 10:51:08 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2007-01-03 10:51:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>partition</td>
|
|
|
|
<td>The partition or filesystem to check for free space</td>
|
|
|
|
<td>Yes</td>
|
2007-01-03 10:51:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>needed</td>
|
|
|
|
<td>The amount of free space needed.</td>
|
|
|
|
<td>Yes</td>
|
2007-01-03 10:51:08 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>An example:</p>
|
|
|
|
<pre><hasfreespace partition="c:" needed="100M"/></pre>
|
2009-08-18 03:08:20 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="islastmodified">islastmodified</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.8.0</em></p>
|
|
|
|
<p>Tests the last modified date of a resource.</p>
|
2009-08-18 03:08:20 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2009-08-18 03:08:20 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2009-08-18 03:08:20 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>millis</td>
|
|
|
|
<td>Specifies the expected modification time of the resource in milliseconds since midnight Jan
|
|
|
|
1 1970.</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
2009-08-18 03:08:20 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>datetime</td>
|
|
|
|
<td class="left">Specifies the expected modification time of the resource. The special
|
|
|
|
value <q>now</q> indicates the current time.</td>
|
2009-08-18 03:08:20 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>pattern</td>
|
|
|
|
<td>SimpleDateFormat-compatible pattern string.</td>
|
|
|
|
<td>No; defaults to <q>MM/dd/YYYY hh:mm a</q> or <q>MM/dd/YYYY hh:mm:ss a</q></td>
|
2009-08-18 03:08:20 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>mode</td>
|
|
|
|
<td>How to compare the timestamp. Accepted values
|
|
|
|
are <q>equals</q>, <q>before</q>, <q>not-before</q>, <q>after</q> and <q>not-after</q>.
|
|
|
|
<td>No; defaults to <q>equals</q></td>
|
2009-08-18 03:08:20 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<p>The actual resource to test is specified as a nested element.</p>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>An example:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2009-08-18 03:08:20 +00:00
|
|
|
<islastmodified dateTime="08/18/2009 04:41:19 AM" mode="not-before">
|
|
|
|
<file file="${file}"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</islastmodified></pre>
|
2009-08-22 05:56:29 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="resourceexists">resourceexists</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.8.0</em></p>
|
|
|
|
<p>Tests a resource for existence.</p>
|
2009-08-22 05:56:29 +00:00
|
|
|
|
|
|
|
<p>The actual resource to test is specified as a nested element.</p>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>An example:</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2009-08-22 05:56:29 +00:00
|
|
|
<resourceexists>
|
|
|
|
<file file="${file}"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</resourceexists></pre>
|
2017-11-29 16:17:34 +01:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="javaversion">javaversion</h4>
|
2018-03-04 15:17:41 +01:00
|
|
|
<p><em>Since Ant 1.10.2</em></p>
|
|
|
|
<p>Tests the version of the JVM executing Ant.</p>
|
2017-11-29 16:17:34 +01:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2017-11-29 16:17:34 +01:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2017-11-29 16:17:34 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>atleast</td>
|
|
|
|
<td>The version that this JVM is of at least. The format
|
|
|
|
is <code>major.minor.point</code>. Starting with Java 9 really only the major number is
|
|
|
|
determined.</td>
|
|
|
|
<td rowspan="2">Exactly one of the two</td>
|
2017-11-29 16:17:34 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>exactly</td>
|
|
|
|
<td class="left">The version that this JVM is of exactly. The format
|
|
|
|
is <code>major.minor.point</code>. Starting with Java 9 really only the major number is
|
|
|
|
determined.</td>
|
2017-11-29 16:17:34 +01:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>An example:</p>
|
2017-11-29 16:17:34 +01:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><javaversion atleast="9"/></pre>
|
2017-11-29 16:17:34 +01:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<p>will evaluate to true if the current JVM is Java 9 or above.</p>
|
2017-11-29 16:17:34 +01:00
|
|
|
|
2001-11-30 12:05:27 +00:00
|
|
|
</body>
|
2002-01-14 00:06:07 +00:00
|
|
|
</html>
|