ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: suggestions
Date Fri, 21 Sep 2001 07:20:41 GMT
On Fri, 21 Sep 2001 15:34, Craig Longman wrote:
> On Thu, 2001-09-20 at 21:54, Peter Donald wrote:
> > > > --- Craig Longman <craigl@begeek.com> wrote:
> > > > >   <target name="target" if="some.property=hello"/>
> > > > >   <target name="target" if="some.property=goodbye"/>
> >
> > Because as soon as we did that there would almost imeadiately be someone
> > who wanted != and then probably < or > or ...
> >
> > Before too long you could have
> >
> > <target name="target" if="((x='y')&&(y>z+u))||(a~=b)"/>
>
> hehe.  yes, i guess you're absolutely right here.  in fact, i had even
> had a thought that if you could do an '=XXX', then why not use a regexp
> as the rhs and then you could do anything.  give 'em an inch... ;-)

;)

> > The if/else target attributes were originally added with much objection
> > from ant-dev and there are some (ie me) who would like to see them
> > removed altogether ;)
>
> interesting.  i am really not sure how i would do some of the things i
> need to do though.  at least, i think i need to do them.  anyway, i
> think if they're kept simple, they can be useful.

Basically an <if/> task so 

<target name="foo" if="X.set"/>

would become

<target name="foo">
 <if test="X.set">
  
 </if>
</target>

This would mean that the notion of <target/> go back to it's original notion 
as a unit of work rather than what it is used for now (basiclly an if block). 
It would also allow much more flexability inside targets.

> > <target name="bar" depends="foo" />
> > <target name="foo" depends="before"/>
>
> very clever.  the only problem is that this would mean i would be
> calling the 'bar' target, when what i really wanted to call was the
> 'foo' target.  but, this definitely acheives the desired effect, albeit
> being a /little/ convoluted.  and i'm sure playing with the names would
> still have the build code read sensibly.

The idea is to get away from thinking notions of order and towards thinking 
notions of dependencies. So what you sound like you want is something like

<target name="foo" depends="bar" />
<target name="bar" depends="old-foo" />
<target name="old-foo" depends="before"/>

So whatever you want to be executed last has to depend on what you want to 
execute first ;)

-- 
Cheers,

Pete

------------------------------------------------------
 Mark Twain: "In the real world, the right thing never
happens in the right place at the right time. It is 
the task of journalists and historians to rectify 
this error."
------------------------------------------------------


Mime
View raw message