ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: [new tasks] presetdef and macrodef
Date Fri, 15 Aug 2003 15:28:53 GMT
On Thursday 14 August 2003 18:50, Jose Alberto Fernandez wrote:
> I think this is fantastic work.
Thanks.
>
> One thing you could do here is redefine <javac> itself
> by doing something like:
>
>    <taskdef name="orig.javac" classname="org.ant.....Javac"/>
>    <presetdef name="javac">
> 	<orig.javac debug="${debug}" deprecation="${deprecation}"/>
>    </presetdef>
>
> which would realize your desired effect. This could be done internally
> by <presetdef/> when for example no name attribute is given.

This could also be done by:

    <presetdef name="javac">
 	<javac debug="${debug}" deprecation="${deprecation}"/>
    </presetdef>

You will however get a warning that the previous definition
of javac has been overridden.

I am thinking of adding an override attribute to allow suppressing
this warning.

>
> > Finally, <presetdef>, in term of functionality and not
> > implementation, is
> > just a subset of <macrodef> in my opinion, and doesn't
> > deserve Task status.
>
> I disagree here, IIUC, <macrodef>'s templates must have ALL the
> content and parameters of the tasks inside, while <presetdef/>
> only sites some sort of default values.
>
> It would be interesting to know what would happen if I write:
>
>    <my.javac debug="true"> ... </my.javac>
>
> would it use the value given in <presetdef> or that given in the actual
> task? If the later, it means that the values given in <presetdef> would be
> default values for the task, which sounds much better.
> Maybe we could rename it <defaultdef/>. :-)

In this case what will happen is that javac#setDebug() gets called twice.
First with the default value and second with "true". The effect
this has depends on the task/type in question. Some tasks set a flag
when an attribute is set and do not allow it to be set again.

Peter

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


Mime
View raw message