If

The 'if' updater class allows a version component to be processed conditionally, providing a specified expression is true.

<version>
  <major></major>
  <minor></minor>
  <build>
    <if unless="true" property="platform" compare="equals" value="x86">
      <fixed value="10" />
    </if>
  </build>
  <revision></revision>
</version>

The example above also makes use of the unless attribute, which acts as a not unary operator to reverse the result of the condition. In this instance, the returned value will be 0 if the supplied platform property equals “x86”, otherwise the result will be 10. As well as setting the property and value to compare, you will also need to set the binary operator to use in the comparison.

The ‘if’ updater class will return an empty string when no child updater classes are supplied. In cases where a number is required, this empty string will interpreted as 0.

Attributes

Attribute Description
unless A Boolean attribute specifying whether to reverse the condition.
property The name of the property whose value will be compared.
compare The method or operator to use in the comparison.
value The value to compare the property with.
mode Defaults to concat. (See Configuration)

Operators

Operators Description
equals Specifies that the property must be equal to the given value.
starts-with Specifies that the property must start with the given value.
ends-with Specifies that the property must end with the given value.
contains Specifies that the property must contain the given value.

Last edited Jan 3, 2013 at 6:50 AM by trwolfe, version 1

Comments

No comments yet.