ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Wall <>
Subject Re: Conditional target execution based on prerequisite execution
Date Wed, 19 Feb 2003 14:11:30 GMT
Ok, I've come up with this (which is overly verbose, and needlessly 
contributes to the complexity of the build script).  Please someone 
with more ant experience correct me where I'm wrong.  Note that since 
properties are "set-once", the uptodate properties target *must* be 
evaluated exactly once, just prior to the real target's execution.  The 
following will cause "mytarget" to only be executed when it's 
considered "out of date".

<target name="mytarget.uptodate.check">
   <uptodate property="mytarget.uptodate">
                       srcfile="mysrc" targetfile="myderived"/>
   <-- or some other condition or property setting -->
<target name="mytarget" depends="dependency1,mytarget.uptodate.check"
   <!-- target tasks here -->

The only reasonable rationale I've heard so far is that it's up to 
tasks within the target to determine whether they really need to run.  
Unfortunately, that embeds the dependency info into another layer, 
which means I now have to stop build scripting and go code java.

View raw message