[quote]
...but you must include the ant-contrib-xxx.jar file in your Ant's
classpath...
[/quote]
It's a lot neater, and portable to other peoples configurations if the
antcontrib lib jar is simply specified in the classpath attribute of the
appropriate taskdef[s].
e.g.
<taskdef resource="*net/sf/antcontrib/antcontrib.properties*"
classpath="*${ant-contrib.jar}*" />
David Weintraub wrote:
In standard Ant, you use the <condition> task to set a property, then
you can use <antcall> to call a task.
<task name="if_else_task">
<condition
property="x.is.true">
<istrue value="${x}"/>
</condition>
<antcall target="do_if_x_is_true"/>
<antcall target="do_if_x_is_false"/>
<echo>Yadda...</echo>
<echo>Yadda...</echo>
<echo>Yadda...</echo>
</target>
<target name="do_if_x_is_true"
if="x.is.true">
<echo>X is True!</echo>
</target>
<target name="do_if_x_is_false"
unless="x.is.true">
<echo>X is False!</echo>
</target>
A little complex, but that's how it's done.
AntContrib (as others have pointed out) has an <if> task:
<if>
<istrue value="${x}"/>
<then>
<echo>X is True!</echo>
</then>
<else>
<echo>X is False</echo>
</else>
</if>
This is simpler, but you must include the ant-contrib-xxx.jar file in
your Ant's classpath, and include a <taskdef> task in your build.xml
file. See the AntContrib website for more information.
On Thu, Feb 14, 2008 at 2:42 PM, jonese <[EMAIL PROTECTED]> wrote:
How would i do something like
if x = true{
stuff
}else{
other stuff
}
in ant? basically i want to see if a property is true and if it is do
x instructions, if it's false do y.
jonese
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
________________________________________________________________________
E-mail is an informal method of communication and may be subject to data
corruption, interception and unauthorised amendment for which I-play, a trading
name of Digital Bridges Ltd will accept no liability. Therefore, it will
normally be inappropriate to rely on information contained on e-mail without
obtaining written confirmation.
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
(C) 2005. I-play is a trademark and trading name of Digital Bridges Limited.
All Rights Reserved.
________________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp