ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ninju Bohra <ninju_bo...@yahoo.com>
Subject RE: Overview on usage of if/unless attributes
Date Wed, 06 Apr 2005 12:34:01 GMT
Some taskdefs support an "if" attribute to control
their behavior (<fail> for example).  However, their
is not guideline, nor list, of which tasks support the
"if" (and "unless") attributes.

There have been efforts to integrate the "if" (and
"unless") logic into all taskdefs, but it has been
rejected repeatedly :-(

So, unless the ANT docs say that a given taskdef
supports the "if" attribute you are stuck with
wrapping the tasks with an <if> (from the ant-contrib
project) or calling them from a separate helper target
that uses the "if" attribute.

--- Rainer Noack <rainer@noacks.net> wrote:
> Hi Holger,
> 
> 1st: Ant properties can not be overwritten.
> 2nd: To set "conditional" property-values take a
> look at the <condition/>
> task.
> 3rd: if/unless are attributes of a target.
> 
> Try something like this:
> 
> <target name="set-props">
> <condition property="prop1"
> value="${basedir}/../..">
>   <isset property="certain.prop"/>
> </condition>
> <property name="prop1" value="${basedir}/.."/>
> </target>
> 
> Cheers,
> 
> Rainer
> 
> > -----Original Message-----
> > From: Holger Rauch [mailto:holger.rauch@heitec.de]
> 
> > Sent: Wednesday, April 06, 2005 11:33 AM
> > To: user@ant.apache.org
> > Subject: Overview on usage of if/unless attributes
> > 
> > 
> > Hi!
> > 
> > I'm aware that if/unless attributes can be used to
> select 
> > targets depending on whether the value of some
> property is 
> > set or not. Where else
> > (types/tasks) can if/unless be used in addition to
> targets?
> > 
> > Is there an overview on this issue in some place?
> > 
> > (I tried using "if" on <property> in order to set
> the value 
> > of a property dependet on whether another property
> is set. 
> > Reason was to avoid the rather lengthy fragments
> introduced 
> > by using ant-contrib's <if> task. Didn't work,
> however, so I 
> > guess I'm stuck with the <if> task, right?)
> > 
> > That's what I tried:
> > 
> > <property name="prop1" value="${basedir}/.." />
> > <property name="prop1" value="${basedir}/../.."
> if="certain.prop" />
> > 
> > Thanks in advance for any info/pointers!
> > 
> > Greetings,
> > 
> > 	Holger
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com


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


Mime
View raw message