> >
> > 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>
>

I was hoping that would be possible.

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

Sounds reasonable.

So instead of using a whole lot of standard user properties to make sure
that all tasks across all buildfiles use the same attribute values (e.g.
${debug}) I can simply <include> a presets.xml buildfile in every project.
Or maybe <presetdef>s could even be inherited when using <ant> or <subant>?

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

Maybe not quite what one would expect.  But I suppose most tasks could be
rewritten to pick up the value when it's set the second time.

--
knut




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

Reply via email to