Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ant question



Rolf,

Have a look at the 'uptodate' task. You can use it to set a property if a source file is more up to date than a target. You can then check if the property is set using the if/unless attributes. An example (from memory, so might not run as typed) is below.

<target name="checkFile">
<uptodate property="fileUpToDate" srcfile="myfile.ext" targetfile="another.file" />
</target>


<target name="conditionalStuff" depends="checkFile"
              unless="fileUpToDate">

   <!-- do something here -->

</target>

The above example should set the property "fileUpToDate" if the target file is more up to date than the source file. The "conditionalStuff" target will then only execute if the property doesn't have a value, i.e. if the source file has a more recent date than the target.

The uptodate task can be used to check multiple files - see the docs, or mail me off list if you have further questions.

Regards,

Neil

On 9 Apr 2005, at 12:13, Rolf Howarth wrote:

Slightly off-topic, but I wonder if anyone can answer a quick Ant question? Most tasks within Ant are clever and "know" which are the output file(s) and which the input(s) so it knows whether the outputs are out of date and need to be rebuilt. However, I have a few external scripts and want to explicitly say "execute this task (or this target) only if file x is older than file y or if file x is missing", just like an old-fashioned makefile. I'm sure I'm missing something obvious but I can't immediately work out how to do this from the Ant manual.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Ant question (From: Rolf Howarth <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.