-1, I think it is a bad idea

> From: Peter Reilly [mailto:[EMAIL PROTECTED] 
> 
...
> I see three places where it/unless attributes could be added 
> to macrodef.
> 
> 1) at the macrodef definition.
>    <macrodef name="showdir" if="on.windows">
>       <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
args.

If there were some form if-else, one would at least know there is some
definintion
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
completely
like it but at least is in the spirit of other tasks. But do I need
support
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"/>
   <sequential>
      <doejb ....>
         <fileset ...>
            <files/>
         </fileset>
      </doejb>
   </sequential>
</macrodef>


And at the point of use one can write:

<ejb>
   <files if="on.windows">
      ....
   </files>
   <files if="on.unix">
      ....
   </files>
</ejb>

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
build
(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
1.7.

Jose Alberto

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

Reply via email to