Hi,
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}"/>
  </presetdef>

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


<macrodef>
  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
  run.

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

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

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

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

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to