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 3.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Condition Task</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. <tr>
  37. <td valign="top">else</td>
  38. <td valign="top">The value to set the property to if the condition
  39. evaluates to <i>false</i>. By default the property will remain unset.
  40. <em>Since Ant 1.6.3</em>
  41. </td>
  42. <td valign="top" align="center">No</td>
  43. </tr>
  44. </table>
  45. <h3><a name="nested">Parameters specified as nested elements</a></h3>
  46. <p>All conditions to test are specified as nested elements, for a
  47. complete list see <a href="conditions.html">here</a>.</p>
  48. <h3>Examples</h3>
  49. <pre>
  50. &lt;condition property=&quot;javamail.complete&quot;&gt;
  51. &lt;and&gt;
  52. &lt;available classname=&quot;javax.activation.DataHandler&quot;/&gt;
  53. &lt;available classname=&quot;javax.mail.Transport&quot;/&gt;
  54. &lt;/and&gt;
  55. &lt;/condition&gt;
  56. </pre>
  57. <p>sets the property <code>javamail.complete</code> if both the
  58. JavaBeans Activation Framework and JavaMail are available in the
  59. classpath.</p>
  60. <pre>
  61. &lt;condition property=&quot;isMacOsButNotMacOsX&quot;&gt;
  62. &lt;and&gt;
  63. &lt;os family=&quot;mac&quot;/&gt;
  64. &lt;not&gt;
  65. &lt;os family=&quot;unix&quot;/&gt;
  66. &lt;/not&gt;
  67. &lt;/and&gt;
  68. &lt;/condition&gt;
  69. </pre>
  70. <p>sets the property <code>isMacOsButNotMacOsX</code> if the current
  71. operating system is MacOS, but not MacOS X - which Ant considers to be
  72. in the Unix family as well.</p>
  73. <pre>
  74. &lt;condition property=&quot;isSunOSonSparc&quot;&gt;
  75. &lt;os name=&quot;SunOS&quot; arch=&quot;sparc&quot;/&gt;
  76. &lt;/condition&gt;
  77. </pre>
  78. <p>sets the property <code>isSunOSonSparc</code> if the current
  79. operating system is SunOS and if it is running on a sparc architecture.</p>
  80. <hr>
  81. <p align="center">Copyright &copy; 2001-2002, 2005 Apache Software
  82. Foundation. All rights Reserved.</p>
  83. </body>
  84. </html>