You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sukanya <su...@yahoo.co.in> on 2008/10/31 08:48:28 UTC

Multiple conditions satisfying in an ant target

Hi All,

I have two separate conditions using equals operator. There is an ant call
to a target. This target has a check for unless with one of the conditions.
How do I include another unless such tat the second condition is also
included in this single ant target. 

eg: 


<condition property="iswow">
 <equals arg1="wow" arg2="wow" trim="true"/>     	
</condition>

<condition property="isbad">
 <equals arg1="bad" arg2="bad" trim="true"/>     	
</condition>
</target>


  
  <target name="antcall"  unless="iswow" >
 
	<echo>Start something new</echo>
</target>


Here how do i inclue isbad also as an unless condition to the same target
antcall?
-- 
View this message in context: http://www.nabble.com/Multiple-conditions-satisfying-in-an-ant-target-tp20261337p20261337.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


RE: Multiple conditions satisfying in an ant target

Posted by sukanya <su...@yahoo.co.in>.
Hi Gilbert,

It works!. I forgot to mention tat either one of these these conditions may
be false and still should work. I replaced <and> with <or> and that also
works :) thanks so much for your timely help.



Rebhan, Gilbert wrote:
> 
> 
> -----Original Message-----
> From: sukanya [mailto:sukanyadevik@yahoo.co.in]
> Sent: Friday, October 31, 2008 8:48 AM
> To: user@ant.apache.org
> Subject: Multiple conditions satisfying in an ant target
> 
> /*
> [...]
> <condition property="iswow">
>  <equals arg1="wow" arg2="wow" trim="true"/>
> </condition>
> 
> <condition property="isbad">
>  <equals arg1="bad" arg2="bad" trim="true"/>
> </condition>
> </target>
> 
> 
> 
>   <target name="antcall"  unless="iswow" >
> 
>         <echo>Start something new</echo>
> </target>
> 
> 
> Here how do i inclue isbad also as an unless condition to the same target
> antcall?
> */
> 
> The unless/if attributes from target takes only only one value, so you
> have
> to combine your conditions like that =
> 
> <condition property="yourcondition">
> <and>
> <equals arg1="wow" arg2="wow" trim="true"/>
> <equals arg1="bad" arg2="bad" trim="true"/>
> </and>
> </condition>
> 
>   <target name="antcall"  unless="yourcondition" >
> 
>         <echo>Start something new</echo>
> </target>
> 
> 
> Regards, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-conditions-satisfying-in-an-ant-target-tp20261337p20261787.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


RE: Multiple conditions satisfying in an ant target

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
-----Original Message-----
From: sukanya [mailto:sukanyadevik@yahoo.co.in]
Sent: Friday, October 31, 2008 8:48 AM
To: user@ant.apache.org
Subject: Multiple conditions satisfying in an ant target

/*
[...]
<condition property="iswow">
 <equals arg1="wow" arg2="wow" trim="true"/>
</condition>

<condition property="isbad">
 <equals arg1="bad" arg2="bad" trim="true"/>
</condition>
</target>



  <target name="antcall"  unless="iswow" >

        <echo>Start something new</echo>
</target>


Here how do i inclue isbad also as an unless condition to the same target
antcall?
*/

The unless/if attributes from target takes only only one value, so you have
to combine your conditions like that =

<condition property="yourcondition">
<and>
<equals arg1="wow" arg2="wow" trim="true"/>
<equals arg1="bad" arg2="bad" trim="true"/>
</and>
</condition>

  <target name="antcall"  unless="yourcondition" >

        <echo>Start something new</echo>
</target>


Regards, Gilbert

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