bodewig 01/08/08 22:48:49 Modified: . WHATSNEW docs/manual coretasklist.html Added: docs/manual/CoreTasks condition.html Log: Documentation for Revision Changes Path 1.144 +2 -1 jakarta-ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/jakarta-ant/WHATSNEW,v retrieving revision 1.143 retrieving revision 1.144 diff -u -r1.143 -r1.144 --- WHATSNEW 2001/08/07 12:02:03 1.143 +++ WHATSNEW 2001/08/09 05:48:48 1.144 @@ -63,7 +63,8 @@ -------------- * New tasks: ear, p4counter, record, cvspass, vsscheckin, vsscheckout, - typedef, sleep, mimemail, set of tasks for Continuus/Synergy, dependset + typedef, sleep, mimemail, set of tasks for Continuus/Synergy, dependset, + condition * Ant now uses JAXP 1.1 1.16 +1 -0 jakarta-ant/docs/manual/coretasklist.html Index: coretasklist.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/manual/coretasklist.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- coretasklist.html 2001/08/06 14:32:45 1.15 +++ coretasklist.html 2001/08/09 05:48:49 1.16 @@ -26,6 +26,7 @@ Apply/ExecOn
Available
Chmod
+Condition
Copy
Copydir
Copyfile
1.1 jakarta-ant/docs/manual/CoreTasks/condition.html Index: condition.html =================================================================== Ant User Manual

Condition

Description

Sets a property if a certain condition holds true - this is a generalization of Available and Uptodate.

If the condition holds true, the property value is set to true by default; otherwise, the property is not set. You can set the value to something other than the default by specifying the value attribute.

Conditions are specified as nested elements, you must specify exactly one condition.

Parameters

Attribute Description Required
property The name of the property to set. Yes
value The value to set the property to. Defaults to "true". No

Parameters specified as nested elements

All conditions to test are specified as nested elements.

not

The <not> 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.

and

The <and> 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.

The <and> condition has the same shortcut semantics as the Java && operator, as soon as one of the nested conditions is false, no other condition will be evaluated.

or

The <or> 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.

The <or> condition has the same shortcut semantics as the Java || operator, as soon as one of the nested conditions is true, no other condition will be evaluated.

available

This condition is identical to the Available task, all attributes and nested elements of that task are supported, the property and value attributes are redundant and will be ignored.

uptodate

This condition is identical to the Uptodate task, all attributes and nested elements of that task are supported, the property and value attributes are redundant and will be ignored.

os

Test whether the current operating system is of a given type.

Attribute Description Required
family The name of the operating system family to expect. No

Supported values for the family attribute are:

equals

Tests whether the two given Strings are identical

Attribute Description Required
arg1 First string to test. Yes
arg2 Second string to test. Yes

Examples

    <condition property="javamail.complete">
      <and>
        <available classname="javax.activation.DataHandler" />
        <available classname="javax.mail.Transport" />
      </and>
    </condition>
  

sets the property javamail.complete if both the JavaBeans Activation Framework and JavaMail are available in the classpath.

    <condition property="isMacOsButNotMacOsX">
      <and>
        <os family="mac" />
        <not>
          <os family="unix" />
        </not>
      </and>
    </condition>
  

sets the property isMacOsButNotMacOsX if the current operating system is MacOS, but not MacOS X - which Ant considers to be in the Unix family as well.


Copyright © 2001 Apache Software Foundation. All rights Reserved.