TaskCall

SourceForge.net Logo

Overview

TaskCall is an Apache Ant task for dynamically calling another task.

For example the following :

<taskcall name="echo" text="Hello !" />

Produces exactly the same result as :

<echo>
  Hello !
</echo>

This task belongs to the meta-scripting style tasks group, it can be used when :

TaskCall has been created to be used along with Import and MacroDef in order to introduce build hook tasks, for example :

<for list="${extensions}" param="extension">
  <sequential>
    <import file="@{extension}.xml" />
  </sequential>
</for>

Loads all extension files listed in the 'extensions' property (using the ant-contrib For task).

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

Defines a task to call all extension build hooks without failing if one of them does not exist.

License

This task is distributed under the Apache Software License.

Compatiblity

TaskCall requires Ant 1.6 in order to run.

Installation

Copy the ant-taskcall.jar file into Ant's lib directory.

In your build file, add the following line :

<taskdef name="taskcall" classname="TaskCall" classpath="ant-taskcall.jar" />