ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt" <mathews_jul...@hotmail.com>
Subject RE: Conditional Statement
Date Wed, 30 Jul 2003 22:15:29 GMT
Yeah Dale, your are right but I am not in the position of telling folks
in my department that after upgrading Ant in the IDE , installing
cvs.exe now start installing antelope.

But yeah antelope makes it far simpler,no doubt.

Matt

-----Original Message-----
From: Dale Anson [mailto:danson@germane-software.com] 
Sent: Wednesday, July 30, 2003 3:10 PM
To: Ant Users List
Subject: Re: Conditional Statement

Whew! Way too much work for such a simple problem.

Antelope is at http://antelope.sourceforge.net. Using <if>:

<project name="test" default="whatever" basedir=".">
   <taskdef name="if" classname="ise.antelope.tasks.IfTask"/>  
   <property name="var1" value="Vik"/>
   <property name="var2" value="Vik"/>
   <target name="whatever">
       <if name="var1" value="${var2}">
         <echo>They are equal.</echo>
         <else>
            <echo>They are different.</echo>
         </else>
       </if>
   </target>
</project>

Docs for <if> are on-line at 
http://antelope.sourceforge.net/manual/bk03ch05.html.

Hope this helps!

Dale



Matt Benson wrote:

>><target name="init">
>>			
>>	<property name="var1" value="Vik"/>
>>	<property name="var2" value="Vik"/>
>>	<property name="var3" value="Viky"/>
>></target>
>><target name="suzCvsTest" description="Test"
>>depends="init">
>>	
>>	<condition property="test">
>>	<equals arg1="${var1}" arg2="${var3}"/>
>>	</condition>
>></target>
>>
>><target name="suzCvsTest1" if="test"
>>description="Test"
>>depends="suzCvsTest">
>>	
>>	<echo message="Values are equal=${test}"/>
>>      
>></target>
>>
>>
>>Now since var1 is not equal to var3 the
>>target=suzCvsTest1 wasn't
>>executed. In the books and manual the "if" attribute
>>in the <target> is
>>defined as "if the given property has been defined
>>the target will be
>>executed".
>>    
>>
>
>Yep, if the property has been defined... but to do an
>either/or:
>
><target name="init">
>	<property name="var1" value="Vik"/>
>	<property name="var2" value="Vik"/>
>	<property name="var3" value="Viky"/>
></target>
><target name="suzCvsTest" description="Test"
>depends="init">
>	<condition property="test">
>		<equals arg1="${var1}" arg2="${var3}"/>
>	</condition>
></target>
>
><target name="resultno" unless="test">
>	<echo message="Values are not equal=${test}"/>
></target>
>
><target name="resultyes" if="test">
>	<echo message="Values are equal=${test}"/>
></target>
>
><target name="suzCvsTest1" description="Test"
>depends="suzCvsTest,resultno,resultyes" />
>
>Kind of big for the amount of work actually being done
>in this contrived example, but you get the general
>idea.
>
>-Matt
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>---------------------------------------------------------------------
>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

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


Mime
View raw message