ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Giroux" <mlgir...@gmail.com>
Subject Re: Simple if/else Condition
Date Fri, 27 Jul 2007 13:15:54 GMT
Hi Evan,

On 7/17/07, Evan J <maps.this.address@gmail.com> wrote:

> if (condition)
>  perform some task, i.e. echo message="condition met"
> else
>  perform another task
>
> Is there such task available in Ant 1.7?

This can be accomplished by wrapping the tasks in individual targets
then defining a target that drives the others via depends:
<condition property="condition.is.set">
  <!-- your test hee -->
</condition>
<target name="t1" if="condition.is.set">
  <echo>condition was true</echo>
</target>
<target name="t2" unless="condition.is.set">
  <echo>condition was false</echo>
</target>

<target name="driver" depends="t1,t2">
  <!-- if condition.is.set then t1 is executed else t2 is executed -->
</target>

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


Mime
View raw message