ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <>
Subject [new tasks] presetdef and macrodef
Date Thu, 14 Aug 2003 09:20:58 GMT
I have written a couple of tasks to enable definition of new tasks
in ant.

<presetdef> (formally known as extendtype)
  this defines a new task or type based on a current ant task or type, with
  attributes or elements preset.

  example useage:
  <presetdef name="my.javac">
       <javac debug="${debug}" deprecation="${deprecation}"/>

  <my.javac> may now be used as a task in the same way as <javac>
  but the attribute debug and deprecation will be preset.

  this defines a new task in the same way as <scriptdef> except it
  uses a <sequential> as a defintion of the task. The <macrodef>
  task has nested elements - param and element to allow the
  user to specify attributes and elements of the new task. These
  get substituted into the <sequential> when the new task is

 example: (from a current project)
     <macrodef name="call-cc">
        <param name="target"/>
        <param name="link"/>
        <param name="target.dir"/>
        <element name="cc-elements"/>
            <mkdir dir="${obj.dir}/${target}"/>
            <mkdir dir="${target.dir}"/>
            <cc link="${link}" objdir="${obj.dir}/${target}"
                <compiler refid="compiler.options"/>

    <macrodef name="compile-exec">
        <param name="program"/>
        <element name="cc-files"/>
            <call-cc target="${program}" link="executable"
                    <includepath location="${gen.dir}"/>
                    <includepath location="test"/>
                    <linker refid="linker-libs"/>

     <compile-exec program="unittests">
                <fileset dir="test/unittest" includes = "**/*.cpp"/>
                <fileset dir="${gen.dir}" includes = "*.cpp"/>

Will I place these tasks in ant or ant-contrib ?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message