You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by James Duncan Davidson <du...@x180.net> on 2001/01/02 23:09:11 UTC

Re: Need if/unless features

On 12/29/00 4:36 AM, "Peter Donald" <do...@apache.org> wrote:

> Agreed - this is a problem ant2.0 will address hopefully. Many people have
> asked for it in one way or another ... What I suggest is something like
> 
> <target name="t1" depends="t2"/>
> <target name="t2" if="execute.t2"/>
> 
> <target name="t1" if="execute.t1">
> <ant-call target="t1"/>
> </target>
> 
> It is not efficient or pretty but it does work ;)

Um, do you really mean to define the same target twice? That doesn't flow
very well.

The way that I think it should be solved is via a "execute-target" task.

<target name="main">
   <execute-target name="foo" if="property.foo"/>
</target>

<target name="foo" depends="bar, bap">..</target>

Having it as just a task means that nothing else gets done unless the
property is set to 1 or true.

.duncan

-- 
James Duncan Davidson                                        duncan@x180.net
                                                                  !try; do()


Re: Need if/unless features

Posted by James Duncan Davidson <du...@x180.net>.
On 1/6/01 9:11 PM, "Jason Rosenberg" <ja...@squaretrade.com> wrote:

>> <target name="main">
>>    <execute-target name="foo" if="property.foo"/>
>> </target>
>> 
>> <target name="foo" depends="bar, bap">..</target>
> 
> The <execute-target> task is good, probably the most succinct way to
> solve a lot of different requests/problems.  It should be augmented, however,
> with "else", "or", "and", "not" functionality.

Yeah. It seemed that way to me as well. Still seems that way. :) And yes,
you'd want to be able to do some combinatorial thing of all of those kinds
of functionality.


-- 
James Duncan Davidson                                        duncan@x180.net
                                                                  !try; do()


Re: Need if/unless features

Posted by Jason Rosenberg <ja...@squaretrade.com>.
----- Original Message ----- 
From: "James Duncan Davidson" <du...@x180.net>
To: <an...@jakarta.apache.org>
Sent: Tuesday, January 02, 2001 5:09 PM
Subject: Re: Need if/unless features


> On 12/29/00 4:36 AM, "Peter Donald" <do...@apache.org> wrote:
> 
> > Agreed - this is a problem ant2.0 will address hopefully. Many people have
> > asked for it in one way or another ... What I suggest is something like
> > 
> > <target name="t1" depends="t2"/>
> > <target name="t2" if="execute.t2"/>
> > 
> > <target name="t1" if="execute.t1">
> > <ant-call target="t1"/>
> > </target>
> > 
> > It is not efficient or pretty but it does work ;)
> 
> Um, do you really mean to define the same target twice? That doesn't flow
> very well.
> 
> The way that I think it should be solved is via a "execute-target" task.
> 
> <target name="main">
>    <execute-target name="foo" if="property.foo"/>
> </target>
> 
> <target name="foo" depends="bar, bap">..</target>
> 
> Having it as just a task means that nothing else gets done unless the
> property is set to 1 or true.
> 

The <execute-target> task is good, probably the most succinct way to
solve a lot of different requests/problems.  It should be augmented, however,
with "else", "or", "and", "not" functionality.

It would certainly be a benefit, though, above the current <antcall> task,
which has the shortcoming that it behaves as a new project, for which
any newly set properties that get set don't persist once the antcall task
is completed....

Jason