TaskCall

Description

Dynamically calls another task.

Parameters

Attribute Description Required
name the name of the task to call Yes
text the value of the text element to call the task with No
failonerror If false silently discard the call if the task does not exist. Defaults to true No

Parameters specified as nested elements

attribute

This is used to specify an attribute for the called task.

Attribute Description Required
name the name of the attribute Yes
value the value of the attribute Yes

elements

This is used to specify nested elements for the called task.
All sub-elements contained within this element are forwarded as elements to the called task.

Examples

<taskcall name="echo">
    <attribute name="message" value="Hello !" />
</taskcall>

Will call the <echo> task with an attribute 'message' which value is 'Hello !'.

<macrodef name="extensions-build">
  <attribute name="input" />
  <attribute name="outdir" />
  <element name="sub-elements" optional="true" implicit="true" />
    <sequential>
      <for list="${extensions}" param="extension">
        <sequential>
          <taskcall name="@{extension}:build" failonerror="false">
            <attribute name="input" value="@{input}" />
            <attribute name="outdir" value="@{outdir}" />
            <elements>
              <sub-elements />
            </elements>
          </taskcall>
        </sequential>
      </for>
    </sequential>
</macrodef>

Defines a composite task that calls a list of sub-tasks depending on a property (named 'extensions').
If any of the sub-task does not exist it will simply be skipped.