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 21:18:15 GMT
Well Sorry for bothering again. But a quick question. I did the
following

<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".

Maybe I am misunderstanding the docs or doing it wrong but does this
definition imply that the target would be executed if the property
associated with "if" equals true. That's what is seems.

What is someone wants  " if property=true execute target1 else execute
target2"".

Matt






-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
Sent: Wednesday, July 30, 2003 2:04 PM
To: Ant Users List
Subject: RE: Conditional Statement

Glad to help.
-Matt

--- Matt <mathews_julien@hotmail.com> wrote:
> Yeah I definitely misunderstood the concept of
> property in <condition>.
> But it seems my dumb mind is getting it a little bit
> now. I did the
> following and it works. Thanks for your help and
> patience.
> 
> <target name="init">
> 			<echo message="Here is the basedir=${basedir}"/>
> 			<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="${var2}"/>
> 	</condition>
>       
> </target>
> 
> 
> <target name="suzCvsTest1" description="Test"
> depends="suzCvsTest">
> 	
> 	
> 	<echo message="Values are equal=${test}"/>
>       
> </target>
> 
> 
> Matt.
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
> Sent: Wednesday, July 30, 2003 1:56 PM
> To: Ant Users List
> Subject: RE: Conditional Statement
> 
> I misunderstood you; it seemed your understanding of
> <condition> is that it only TESTED properties. 
> Still,
> the functionality provided is adequate according to
> the Ant paradigm.  It is slightly more verbose than
> the <if>, etc. tasks provided by Dale Anson's
> Antelope
> project (that should be enough information for you
> to
> search for the project); however those who wish not
> to
> use external tasks for whatever reason might do:
> 
> <target name="x" depends="y"
> if="somefileexistsonwindoze">
>  ...
> </target>
> 
> <target name="y">
>   <condition property="somefileexistsonwindoze">
>     <and>
>       <os family="windows" />
>       <available file="somefile" type="file" />
>     </and>
>   </condition>
> </target>
> 
> -Matt
> 
> --- Matt <mathews_julien@hotmail.com> wrote:
> > Property attribute is required for <condition>
> task
> > but I don't need to
> > set any property. All the examples are setting
> some
> > kind of property
> > only.
> > 
> > 
> > 
> > -----Original Message-----
> > From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
> > Sent: Wednesday, July 30, 2003 1:46 PM
> > To: Ant Users List
> > Subject: RE: Conditional Statement
> > 
> > You need to reread the <condition> documentation
> AKA
> > RTFM.
> > 
> > regards,
> > another Matt
> > 
> > --- Matt <mathews_julien@hotmail.com> wrote:
> > > It seems <condition> is supposed to be used for
> > > properties only. And
> > > what's antelope. I tried to do this simple task
> > and
> > > it doesn't work.
> > > 
> > > <target name="init">
> > > 			<echo message="Here is the
> > basedir=${basedir}"/>
> > > 			<property name="var1" value="Vik"/>
> > > 			<property name="var2" value="Vik"/>
> > > 			<property name="var3" value="Viky"/>
> > > 			
> > > 	</target>
> > > 
> > > 
> > > 
> > > <target name="Test" description="CVS Import"
> > > depends="init">
> > > 	
> > > 	<condition>
> > > 	<equals arg1="${var1}" arg2="${var2}"/>
> > > 	<echo message="Values are equal"/>
> > > 	</condition>
> > >       
> > > </target>
> > > 
> > > 
> > > Matt
> > > 
> > > -----Original Message-----
> > > From: Antoine Levy-Lambert
> > > [mailto:antoine@antbuild.com] 
> > > Sent: Wednesday, July 30, 2003 1:32 PM
> > > To: Ant Users List
> > > Subject: Re: Conditional Statement
> > > 
> > > <condition> see the manual.
> > > Otherwise have a look at <if> in antelope or
> > > ant-contrib.
> > > Cheers,
> > > Antoine
> > > ----- Original Message ----- 
> > > From: "Matt" <mathews_julien@hotmail.com>
> > > To: "'Ant Users List'" <user@ant.apache.org>
> > > Sent: Wednesday, July 30, 2003 10:29 PM
> > > Subject: Conditional Statement
> > > 
> > > 
> > > > Hi
> > > > 
> > > > How do we add "if-else" statements in Ant. I
> > need
> > > to compare two
> > > > variables and execute a task if they are not
> > equal
> > > and abort with an
> > > > error message if they are equal.
> > > > 
> > > > Matt
> > > > 
> > > > 
> > > > 
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > 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
> > > 
> > 
> > 
> > __________________________________
> > 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
> 
=== message truncated ===


__________________________________
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


Mime
View raw message