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]
>
>
--
--
David Weintraub
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]