ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Uther <will+...@cs.cmu.edu>
Subject Re: conditionals and loops (was: Macro task (was: ...))
Date Fri, 25 Feb 2000 17:10:21 GMT
--On Fri, Feb 25, 2000 7:54 AM -0500 rubys@us.ibm.com wrote:

> Where I recognize that with need for conditional and loop structures is
> greatest in tasks, like Costin, I would like to see this support
> generalized to support any XML element.

Ok, I can see that.

> It looks like this could be done
> by taking a select few XML elements and hardwire them into ant - much like
> many shells, makes, and programming languages do.
> 
> Essentially, if
>    <foreach var="i" in="a b c"> <foo arg="${i}"/> <bar/> </foreach>
> got translated into
>     <property name="i" value="a"><foo arg="${i}"/> <bar/>
>    <property name="i" value="b"><foo arg="${i}"/> <bar/>
>    <property name="i" value="c"><foo arg="${i}"/> <bar/>
>    <property name="i" value="whateverValueIHadBefore">
> 
> ...and all this got done prior to the remainder of Ant being executed,
> then we would have a solution that would have applicability beyond simple
> tasks.

I originally was thinking something very like this - replicating tasks
within the current hierarchy.  I decided I dislike this solution.

I dislike it because it preserves the current strange semantics.  For
example, this forces static determination of the number of times a loop
will be executed.

Now, that is not to say that you couldn't have something, with a more
normal semantics, that works with any XML element.  Maybe you hard-wire a
few XML elements, but they do the replication at execution-time instead of
parse-time.  (I'm not even sure you need to hard-wire anything.  If someone
puts a createForeach() method in their Task they lose standard ForEach
capability.  You then define ForEach using a plugin architecture, like
Tasks.)

I agree this needs some thought as to the details.  I would strongly like
to move in this direction though.

later,

\x/ill         :-}


Mime
View raw message