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.

condition.html 2.7 KiB

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