ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: <macrodef> and local
Date Wed, 23 Jun 2004 11:00:19 GMT
-1, I think it is a bad idea

> From: Peter Reilly [] 
> I see three places where it/unless attributes could be added 
> to macrodef.
> 1) at the macrodef definition.
>    <macrodef name="showdir" if="">
>       <attribute name="dir"/>
>       <sequential>
>          <ac:shellscript script="cmd.exe" tmpsuffix=".bat">
>             <ac:value="/c"/>
>             <ac:value="call"/>
>             dir @{dir}
>          </ac:shellscript>
>      </sequential>
>    </macrodef>
>    <macrodef name="showdir" if="on.linux">
>       <sequential>
>          <ac:shellscript script="bash">
>             ls -rlta @{dir}
>          </ac:shellscript>
>      </sequential>
>    </macrodef>

If we have such a thing, how do I know whether the macro exists at all
or not at my point of use. Whether they do the same or have the same

If there were some form if-else, one would at least know there is some
for it.

> 2) on the sequential element:
> <macrodef name="ejb">
>    <attribute name="module">
>    <sequential unless="@{module}-uptodate">
>       <...>
>    </sequential>
> </macrodef>

So what happens if the property does exists, the definition is empty?

> 3) at the macrodef use:
>   <ejb module="x" unless="x-uptodate"/>

This probably is the most traditional usage of if/unless I do not
like it but at least is in the spirit of other tasks. But do I need
from macrodef, or can I write this myself as part of my macrodef.
I.e., shall <macrodef/> hyjack if/unless as reserved attribute names (I
would prefer not).

Another usage of if/unless that may be interesting (not that I am
advocating it or anything)
is at the point of use of elements:

<macrodef name="ejb">
   <element name="files"/>
      <doejb ....>
         <fileset ...>

And at the point of use one can write:

   <files if="">
   <files if="on.unix">

Which will pass the different <files/> elements depending of the
properties settings.
Now, the reason I do not like it is because I think we need to put our
effort in some
core way to describe inclusion/exclusion of elements at any level of a
(or at least of task) and it should be project-helper the one in charge
of doing it.

This would also include the ideas about having a real expression
language to 
specify those inclusions and exclusions.

I think that would be a much more powerful thing to spend our time on

Jose Alberto

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

View raw message