ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: setting a property based on a condition
Date Thu, 23 Aug 2001 19:42:00 GMT
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 <Anthony@WeddingChannel.com> 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


=====
(holtdl@yahoo.com)



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

Mime
View raw message