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 KiB

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