ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <jalbe...@cellectivity.com>
Subject RE: <macrodef> and local
Date Mon, 21 Jun 2004 16:52:39 GMT
> From: Jack J. Woehr [mailto:jax@purematrix.com] 
> 
> It seems to me that if someone really needs this sort of 
> thing, then the use of Ant-Contrib's Variable is pretty much 
> sufficient, esp. if property parsing becomes recursive (e.g., 
> per the patch I submitted already) so that you can access 
> properties via a second-level indirection. Would one then 
> still need locals? If absolutely necessary, a 
> GenUniquePropertyName task could be coded.

The way I see it, a macrodef <let> will also solve the issue
of concurrency. Notice that in all this cases the issue is
how do you refer to the value just generated. Lets assume you
have the macro I defined before:

<macrodef name="example">
  <attribute name="foo"/>
  <let name="basefoo"/>
  <sequential>
    <basename property="@{basefoo}" file="@{foo}"/>
    <echo massage="${@{basefoo}}"/>
  </sequential>
</macrodef>

Now you run this macro in parallel with diferent input values:

  <parallel>
    <example foo="/a/b1/c"/>
    <example foo="/a/b2/c"/>
    <example foo="/a/b3/c"/>
    <example foo="/a/b4/c"/>
    <example foo="/a/b5/c"/>
    <example foo="/a/b6/c"/>
    <example foo="/a/b7/c"/>
  </parallel>

You want to get 7 different echo lines, order irrelevant. Which means
using seven different intermediate properties, but still you need to
refer to each one in particular during the sequential.

The question is how the GenUniquePropertyName task can achieve this.
How do I write the chunck of code for it.

With this addition to macro it is quite simple. At least for this simple
case.

Jose Alberto

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


Mime
View raw message