I have an application that

1. downloads foo.zip file from the web
2. unzips foo.zip
3. runs foo.bat that came from foo.zip

If foo.bat already exists and is newer than foo.zip, I don't need to do step 2.
If foo.zip is already downloaded, I don't need to run step 1.

How can I set up my build.xml to only do the minimum required, based on the 
existence and file time comparisons that a makefile would do?

The solution doesn't seem to relate to the target "depends" attribute, because 
that only refers to whether the other target has been executed in the current 
Ant project.  The "available" task can be used to set a property if a file 
*exists*, but not if it does *not* exist or if it is out of date.  Similarly, 
the target "if" attribute causes a target to be run if a property exists, but 
not if it does not exist.

What I think I need is something like

<target name="run" depends="unzip">...</target>
<target name="unzip" depends="download" 
if="foo.bat_is_older_than_foo.zip">...</target>
<target name="download" if="foo.zip_does_not_exist">...</target>

Am I missing something obvious?  make handles this easily.

Phil Hanna
E-Commerce Solutions
SAS Institute, Inc.
[EMAIL PROTECTED]
(919) 677-8000 x4284


Reply via email to