ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: conditional execution
Date Tue, 21 Feb 2006 21:52:21 GMT
If the existance of a file is your condition, use a combination of
<available>, <antcall>, <target if=  and <target unless= . Check out the
example below...

<available property="it.exists" file="path/to/some/file"/>

<target name="do.this.or.that">
  <antcall target="do.this"/>
  <antcall target="do.that"/>
</target>

<target name="do.this" if="it.exists">
...
</target>

<target name="do.that" unless="it.exists">
...
</target>

You could probably do something similar for equal files with the
<condition> task.

-Rob Anderson

> -----Original Message-----
> From: Paul Pogonyshev [mailto:p.pogonyshev@finamatics.com] 
> Sent: Friday, February 17, 2006 7:04 AM
> To: user@ant.apache.org
> Subject: conditional execution
> 
> Hi,
> 
> Is it possible to do some sorts of conditional execution of 
> tasks other than <target if/unless="..."> and scripts 
> (require extensions)?
> 
> I need things like if file exists, do this, else do that.  
> Or, if files are equal (byte-wise), do something.
> 
> Paul
> 
> ---------------------------------------------------------------------
> 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