ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mehra, Vishal" <vme...@inovant.com>
Subject RE: Conditional Statement
Date Wed, 30 Jul 2003 21:07:13 GMT

Is it possible to do if/condition on a ant task.

i.e. if ant task fails (like javac) then email_build_failed else email_build_success

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