Thank you, it worked perfectly.

-----Original Message-----
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 23, 2001 12:42 PM
To: [EMAIL PROTECTED]
Subject: Re: setting a property based on a condition


With 1.4, you could use the new <condition> task:

  <target name="setProp">
    <condition property="num" value="1">
      <equals arg1="${foo}" arg2="true"/>
    </condition>
    <condition property="num" value="2">
      <equals arg1="${foo}" arg2="false"/>
    </condition>
    <echo message="num is ${num}"/>
  </target>

(In pre-1.4, you'd need to use the <script> task.)

Diane

--- Anthony Rodriguez <[EMAIL PROTECTED]> wrote:
> Quick question:
> 
> Is there any way to set a property in ant based on a condition? For
> example,
> say I have a boolean property named "foo".  Now I want to set a property
> named "num" to 1 if foo is true or set num to 2 if foo is false.  Here
> is
> some pseudo ant to better explain my question:
> 
> pseudobuild.xml:
> ...
> <target name="init">
>       <property name="foo" value="true"/>
>       <property name="num"  if ${foo} value="1" else value="2"/>
> </target>
> ...
> 
> Any way to do this in ant?  Thanks for any help.
> 
> -Anthony


=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Reply via email to