You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

conditions.html 9.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Conditions Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="Conditions">Conditions</a></h2>
  8. <p>These are the nested elements that can be used as conditions in the
  9. <a href="condition.html"><code>&lt;condition&gt;</code></a> and
  10. <a href="waitfor.html"><code>&lt;waitfor&gt;</code></a> tasks.</p>
  11. <h4>not</h4>
  12. <p>The <code>&lt;not&gt;</code> element expects exactly one other
  13. condition to be nested into this element, negating the result of the
  14. condition. It doesn't have any attributes and accepts all nested
  15. elements of the condition task as nested elements as well.</p>
  16. <h4>and</h4> <p>
  17. The <code>&lt;and&gt;</code> element doesn't have any attributes and
  18. accepts an arbitrary number of conditions as nested elements - all
  19. nested elements of the condition task are supported. This condition
  20. is true if all of its contained conditions are, conditions will be
  21. evaluated in the order they have been specified in the build file.</p>
  22. <p>The <code>&lt;and&gt;</code> condition has the same shortcut
  23. semantics as the Java &amp;&amp; operator, as soon as one of the
  24. nested conditions is false, no other condition will be evaluated.</p>
  25. <h4>or</h4> <p>
  26. The <code>&lt;or&gt;</code> element doesn't have any attributes and
  27. accepts an arbitrary number of conditions as nested elements - all
  28. nested elements of the condition task are supported. This condition
  29. is true if at least one of its contained conditions is, conditions
  30. will be evaluated in the order they have been specified in the build
  31. file.</p> <p>The <code>&lt;or&gt;</code> condition has the same
  32. shortcut semantics as the Java || operator, as soon as one of the
  33. nested conditions is true, no other condition will be evaluated.</p>
  34. <h4>available</h4>
  35. <p>This condition is identical to the <a
  36. href="available.html">Available</a> task, all attributes and nested
  37. elements of that task are supported, the property and value attributes
  38. are redundant and will be ignored.</p>
  39. <h4>uptodate</h4>
  40. <p>This condition is identical to the <a
  41. href="uptodate.html">Uptodate</a> task, all attributes and nested
  42. elements of that task are supported, the property and value attributes
  43. are redundant and will be ignored.</p>
  44. <h4>os</h4>
  45. <p>Test whether the current operating system is of a given type. Each
  46. defined attribute is tested and the result is true only if <i>all</i>
  47. the tests succeed.
  48. </p>
  49. <table border="1" cellpadding="2" cellspacing="0">
  50. <tr>
  51. <td valign="top"><b>Attribute</b></td>
  52. <td valign="top"><b>Description</b></td>
  53. <td align="center" valign="top"><b>Required</b></td>
  54. </tr>
  55. <tr>
  56. <td valign="top">family</td>
  57. <td valign="top">The name of the operating system family to expect.</td>
  58. <td valign="top" align="center">No</td>
  59. </tr>
  60. <tr>
  61. <td valign="top">name</td>
  62. <td valign="top">The name of the operating system to expect.</td>
  63. <td valign="top" align="center">No</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">arch</td>
  67. <td valign="top">The architecture of the operating system to expect.</td>
  68. <td valign="top" align="center">No</td>
  69. </tr>
  70. <tr>
  71. <td valign="top">version</td>
  72. <td valign="top">The version of the operating system to expect.</td>
  73. <td valign="top" align="center">No</td>
  74. </tr>
  75. </table>
  76. <p>Supported values for the family attribute are:
  77. <ul>
  78. <li>windows (for all versions of Microsoft Windows)</li>
  79. <li>dos (for all Microsoft DOS based operating systems including
  80. Microsoft Windows and OS/2)</li>
  81. <li>mac (for all Apple Macintosh systems)</li>
  82. <li>unix (for all Unix and Unix-like operating systems)</li>
  83. <li>netware (for Novell NetWare)</li>
  84. <li>os/2 (for OS/2)</li>
  85. <li>win9x for Microsoft Windows 95 and 98</li>
  86. <li>z/os for z/OS and OS/390</li>
  87. </ul>
  88. <h4>equals</h4>
  89. <p>Tests whether the two given Strings are identical</p>
  90. <table border="1" cellpadding="2" cellspacing="0">
  91. <tr>
  92. <td valign="top"><b>Attribute</b></td>
  93. <td valign="top"><b>Description</b></td>
  94. <td align="center" valign="top"><b>Required</b></td>
  95. </tr>
  96. <tr>
  97. <td valign="top">arg1</td>
  98. <td valign="top">First string to test.</td>
  99. <td valign="top" align="center">Yes</td>
  100. </tr>
  101. <tr>
  102. <td valign="top">arg2</td>
  103. <td valign="top">Second string to test.</td>
  104. <td valign="top" align="center">Yes</td>
  105. </tr>
  106. <tr>
  107. <td valign="top">casesensitive</td>
  108. <td valign="top">Perform a case sensitive comparision. Default is
  109. true.</td>
  110. <td valign="top" align="center">No</td>
  111. </tr>
  112. <tr>
  113. <td valign="top">trim</td>
  114. <td valign="top">Trim whitespace from arguments before comparing
  115. them. Default is false.</td>
  116. <td valign="top" align="center">No</td>
  117. </tr>
  118. </table>
  119. <h4>isset</h4>
  120. <p>Test whether a given property has been set in this project.</p>
  121. <table border="1" cellpadding="2" cellspacing="0">
  122. <tr>
  123. <td valign="top"><b>Attribute</b></td>
  124. <td valign="top"><b>Description</b></td>
  125. <td align="center" valign="top"><b>Required</b></td>
  126. </tr>
  127. <tr>
  128. <td valign="top">property</td>
  129. <td valign="top">The name of the property to test.</td>
  130. <td valign="top" align="center">Yes</td>
  131. </tr>
  132. </table>
  133. <h4>checksum</h4>
  134. <p>This condition is identical to the <a href="checksum.html">Checksum</a>
  135. task, all attributes and nested elements of that task are supported,
  136. the property and overwrite attributes are redundant and will be
  137. ignored.</p>
  138. <h4>http</h4>
  139. <p>The <code>http</code> condition checks for a valid response from a
  140. web server of the specified url. By default, HTTP responses errors
  141. of 400 or greater are viewed as invalid.</p>
  142. <table border="1" cellpadding="2" cellspacing="0">
  143. <tr>
  144. <td width="12%" valign="top"><b>Attribute</b></td>
  145. <td width="78%" valign="top"><b>Description</b></td>
  146. <td width="10%" valign="top"><b>Required</b></td>
  147. </tr>
  148. <tr>
  149. <td valign="top">url</td>
  150. <td valign="top">The full URL of the page to request. The web server must
  151. return a status code of &lt;<tt>errorsBeginAt</tt></td>
  152. <td align="center">Yes.</td>
  153. <td valign="top">errorsBeginAt</td>
  154. <td valign="top">The lowest HTTP response code that signals an error;
  155. by default '400'; server errors, not-authorized, not-found and the like
  156. are detected</td>
  157. <td align="center">No</td>
  158. </tr>
  159. <tr>
  160. <td valign="top">errorsBeginAt</td>
  161. <td valign="top">The lowest HTTP response code that signals an error;
  162. by default '400'; server errors, not-authorized, not-found and the like
  163. are detected</td>
  164. <td align="center">No</td>
  165. </tr>
  166. </table>
  167. <h4>socket</h4>
  168. <p>The <code>socket</code> condition checks for the existence of a
  169. TCP/IP listener at the specified host and port.</p>
  170. <table border="1" cellpadding="2" cellspacing="0">
  171. <tr>
  172. <td width="12%" valign="top"><b>Attribute</b></td>
  173. <td width="78%" valign="top"><b>Description</b></td>
  174. <td width="10%" valign="top"><b>Required</b></td>
  175. </tr>
  176. <tr>
  177. <td valign="top">server</td>
  178. <td valign="top">The DNS name or IP address of the server.</td>
  179. <td align="center">Yes.</td>
  180. </tr>
  181. <tr>
  182. <td valign="top">port</td>
  183. <td valign="top">The port number to connect to.</td>
  184. <td align="center">Yes.</td>
  185. </tr>
  186. </table>
  187. <h4>filesmatch</h4>
  188. <p>Test two files for matching. Nonexistence of either file results in "false".
  189. This test does a byte for byte comparision, so test time scales with
  190. byte size. NB: if the files are different sizes , one of them is missing
  191. or the filenames match the answer is so obvious the detailed test is omitted.
  192. </p>
  193. <table border="1" cellpadding="2" cellspacing="0">
  194. <tr>
  195. <td width="12%" valign="top"><b>Attribute</b></td>
  196. <td width="78%" valign="top"><b>Description</b></td>
  197. <td width="10%" valign="top"><b>Required</b></td>
  198. </tr>
  199. <tr>
  200. <td valign="top">file1</td>
  201. <td valign="top">First file to test</td>
  202. <td align="center">Yes.</td>
  203. </tr>
  204. <tr>
  205. <td valign="top">file2</td>
  206. <td valign="top">Second file to test</td>
  207. <td align="center">Yes.</td>
  208. </tr>
  209. </table>
  210. <h4>contains</h4>
  211. <p>Tests whether a string contains another one.</p>
  212. <table border="1" cellpadding="2" cellspacing="0">
  213. <tr>
  214. <td valign="top"><b>Attribute</b></td>
  215. <td valign="top"><b>Description</b></td>
  216. <td align="center" valign="top"><b>Required</b></td>
  217. </tr>
  218. <tr>
  219. <td valign="top">string</td>
  220. <td valign="top">The string to search in.</td>
  221. <td valign="top" align="center">Yes</td>
  222. </tr>
  223. <tr>
  224. <td valign="top">substring</td>
  225. <td valign="top">The string to search for.</td>
  226. <td valign="top" align="center">Yes</td>
  227. </tr>
  228. <tr>
  229. <td valign="top">casesensitive</td>
  230. <td valign="top">Perform a case sensitive comparision. Default is
  231. true.</td>
  232. <td valign="top" align="center">No</td>
  233. </tr>
  234. </table>
  235. <h4>istrue</h4>
  236. <p>Tests whether a string equals any of the ant definitions of true,
  237. that is "true","yes", or "on"</p>
  238. <table border="1" cellpadding="2" cellspacing="0">
  239. <tr>
  240. <td valign="top"><b>Attribute</b></td>
  241. <td valign="top"><b>Description</b></td>
  242. <td align="center" valign="top"><b>Required</b></td>
  243. </tr>
  244. <tr>
  245. <td valign="top">value</td>
  246. <td valign="top">value to test</td>
  247. <td valign="top" align="center">Yes</td>
  248. </tr>
  249. </table>
  250. <pre>
  251. &lt;istrue value=&quot;${someproperty}&quot; /&gt;
  252. &lt;istrue value=&quot;false&quot; /&gt;
  253. </pre>
  254. <h4>isfalse</h4>
  255. <p>Tests whether a string is not true, the negation of &lt;istrue&gt;
  256. </p>
  257. <table border="1" cellpadding="2" cellspacing="0">
  258. <tr>
  259. <td valign="top"><b>Attribute</b></td>
  260. <td valign="top"><b>Description</b></td>
  261. <td align="center" valign="top"><b>Required</b></td>
  262. </tr>
  263. <tr>
  264. <td valign="top">value</td>
  265. <td valign="top">value to test</td>
  266. <td valign="top" align="center">Yes</td>
  267. </tr>
  268. </table>
  269. <pre>
  270. &lt;isfalse value=&quot;${someproperty}&quot; /&gt;
  271. &lt;isfalse value=&quot;false&quot; /&gt;
  272. </pre>
  273. <hr>
  274. <p align="center">Copyright &copy; 2001-2002 Apache Software
  275. Foundation. All rights Reserved.</p>
  276. </body>
  277. </html>