ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Time-based dependencies
Date Wed, 12 Jul 2000 19:50:45 GMT
Phil,

Even with Marius' 'obsolete' task, your original proposed task sequence is
only going to download the zipfile if it doesnt exis't on the local system.
So if the web based file changes, those changes will not propagate as far as
the unzipped file unless you delete the local copy.

What you'd need to do is extend the GET task to use the appropriate HTTP
headers to request a target file only if it is newer than the local copy,
just as if the client were updating its web cache. It might also be
appropriate to have the downloaded local copy have its date set to that of
the remote file, but that is hazardous as (a) you can't do that pre JDK1.2
and (b) sometimes it isnt always appropriate. Making that an (off by
default) option would be the sensible choice.


-Steve

[A more powerful variant GET task is something I've debated doing in my
copious free time; full WebDAV method calls using the Slide client side is
the ideal goal, but perhaps timestamping would be a useful first step].

----- Original Message -----
From: "Phil Hanna" <Phil.Hanna@sas.com>
To: <ant-dev@jakarta.apache.org>
Sent: Wednesday, July 12, 2000 12:12
Subject: RE: Time-based dependencies


Thanks, Glenn.  You're right, this is closer to a solution.

The example I gave needed to test foo.bat to see if it was *older* than
foo.zip, not newer.  In other words, if I have foo.bat from Monday and there
is a foo.zip dated Tuesday, my foo.bat is out of date, and I need to do the
unzip.

This is analogous to compile - link - create DLL for .c files.  In make, you
set up targets (well, actually there are built-in rules, but let's pretend
there aren't) that declare the .dll file to be dependent on the .obj, and
the .obj on the .c.  make figures out which if any are out of date and
starts the build at the appropriate point.

Now that I think of it, perhaps this could be accomplished by a custom task
"older" similar to "available":

<target name="init">
   <older first="foo.bat" second="foo.zip" property="bat.is.older"/>
</target>

<target name="unzip" if="bat.is.older" depends="init">
... unzip foo.zip
</target>

The implementation should set the property to true if the first object does
not exist or if its timestamp is less than the timestamp of the second
object

(snip)

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.
Phil.Hanna@sas.com
(919) 677-8000 x4284







Mime
View raw message