ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: [new tasks] presetdef and macrodef
Date Thu, 14 Aug 2003 12:13:26 GMT

The following tasks will be an excellent addition for the use Centipede 
does of Ant, so it's a big thumbs up!

Presetdef can be used to redefine the most used Ant tasks adding the 
defaults taken from the descriptor we use.

macrodef can make us finally create real macros that are not only 
targets, as instead has been done till now, so we can really make 
libraries of tasks defined through Ant buildfiles and not have them 
necessarily as targets.

:-D

peter reilly wrote, On 14/08/2003 11.20:
> 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

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message