Table of Contents

The following sections describe the custom conditions provided by the Build Extensions Toolkit. Conditions are nested elements of the condition and waitfor tasks that evaluate to true or false.

Custom conditions are datatypes that extend the Ant Core Conditions to simplify and facilitate writing custom Ant scripts.

endsWith

The endsWith condition compares the specified string to the specified with to determine if string string ends with string with and returns true if it does and false if not. The following table describes the attributes for the endsWith condition:

Attribute Description Required
string The string value to evaluate. Yes
with The ending string value to look for. Yes

Examples:

<condition property="endsWithTrue" else="false">
  <xt:endsWith string="ConditionTests" with="Tests"/>
</condition>

<echo>endsWithTrue:    ${endsWithTrue}${line.separator}</echo>

<condition property="endsWithFalse" else="false">
  <xt:endsWith string="ConditionTests" with="False"/>
</condition>

<echo>endsWithFalse:   ${endsWithFalse}${line.separator}</echo>
      

Results:

endsWithTrue:    true
endsWithFalse:   false
      

isLoggerVerbose

The isLoggerVerbose condition determines if -verbose has been specified in the Ant arguments for the build and returns true if so and false if not. There are no attributes for the isLoggerVerbose condition.

Examples:

<condition property="isLoggerVerbose" else="false">
  <xt:xt:isLoggerVerbose/>
</condition>

<echo>isLoggerVerbose: ${isLoggerVerbose}${line.separator}</echo>
      

Results:

isLoggerVerbose: true
      

isPropertyFalse

The isPropertyFalse condition determines if the specified property resolves to one of the various forms of false - "false", "no", or zero - and returns true if it does and false if not. The following table describes the attributes for the isPropertyFalse condition:

Attribute Description Required
defaultValue The default value to use should the specified property not exist. No
property The name of the Ant property to test. Yes

Examples:

<condition property="isNotThereFalse1" else="false">
  <xt:isPropertyFalse property="fakeProperty"/>
</condition>
<condition property="isNotThereFalse2" else="false">
  <xt:isPropertyFalse property="fakeProperty" default="true"/>
</condition>
<condition property="isNotThereFalse3" else="false">
  <xt:isPropertyFalse property="fakeProperty" default="false"/>
</condition>

<echo>isNotThereFalse1: ${isNotThereFalse1}${line.separator}</echo>
<echo>isNotThereFalse2: ${isNotThereFalse2}${line.separator}</echo>
<echo>isNotThereFalse3: ${isNotThereFalse3}${line.separator}</echo>

<property name="falseProperty" value="false"/>

<condition property="isPropertyFalse1" else="false">
  <xt:isPropertyFalse property="falseProperty"/>
</condition>
<condition property="isPropertyFalse2" else="false">
  <xt:isPropertyFalse property="falseProperty" default="true"/>
</condition>
<condition property="isPropertyFalse3" else="false">
  <xt:isPropertyFalse property="falseProperty" default="false"/>
</condition>

<echo>isPropertyFalse1: ${isPropertyFalse1}${line.separator}</echo>
<echo>isPropertyFalse2: ${isPropertyFalse2}${line.separator}</echo>
<echo>isPropertyFalse3: ${isPropertyFalse3}${line.separator}</echo>
      

Results:

isNotThereFalse1: false
isNotThereFalse2: false
isNotThereFalse3: true
isPropertyFalse1: true
isPropertyFalse2: true
isPropertyFalse3: true
      

isPropertyTrue

The isPropertyTrue condition determines if the specified property resolves to one of the various forms of true - "true", "yes", or one - and returns true if it does and false if not. The following table describes the attributes for the isPropertyTrue condition:

Attribute Description Required
defaultValue The default value to use should the specified property not exist. No
property The name of the Ant property to test. Yes

Examples:

<condition property="isNotThereTrue1" else="false">
  <xt:isPropertyTrue property="fakeProperty"/>
</condition>
<condition property="isNotThereTrue2" else="false">
  <xt:isPropertyTrue property="fakeProperty" default="true"/>
</condition>
<condition property="isNotThereTrue3" else="false">
  <xt:isPropertyTrue property="fakeProperty" default="false"/>
</condition>

<echo>isNotThereTrue1: ${isNotThereTrue1}${line.separator}</echo>
<echo>isNotThereTrue2: ${isNotThereTrue2}${line.separator}</echo>
<echo>isNotThereTrue3: ${isNotThereTrue3}${line.separator}</echo>

<property name="trueProperty" value="true"/>

<condition property="isPropertyTrue1" else="false">
  <xt:isPropertyTrue property="trueProperty"/>
</condition>
<condition property="isPropertyTrue2" else="false">
  <xt:isPropertyTrue property="trueProperty" default="true"/>
</condition>
<condition property="isPropertyTrue3" else="false">
  <xt:isPropertyTrue property="trueProperty" default="false"/>
</condition>

<echo>isPropertyTrue1: ${isPropertyTrue1}${line.separator}</echo>
<echo>isPropertyTrue2: ${isPropertyTrue2}${line.separator}</echo>
<echo>isPropertyTrue3: ${isPropertyTrue3}${line.separator}</echo>
      

Results:

isNotThereTrue1: false
isNotThereTrue2: true
isNotThereTrue3: false
isPropertyTrue1: true
isPropertyTrue2: true
isPropertyTrue3: true
    

startsWith

The startsWith condition compares the specified string to the specified with to determine if string string starts with string with and returns true if it does and false if not. The following table describes the attributes for the startsWith condition:

Attribute Description Required
string The string value to evaluate. Yes
with The starting string value to look for. Yes

Examples:

<condition property="startsWithTrue" else="false">
  <xt:startsWith string="ConditionTests" with="Condition"/>
</condition>

<echo>startsWithTrue:  ${startsWithTrue}${line.separator}</echo>

<condition property="startsWithFalse" else="false">
  <xt:startsWith string="ConditionTests" with="False"/>
</condition>

<echo>startsWithFalse: ${startsWithFalse}${line.separator}</echo>
      

Results:

startsWithTrue:  true
startsWithFalse: false