ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <>
Subject Re: Checking a file for modification during p4sync task
Date Fri, 20 Jun 2003 09:03:43 GMT
The other option that you can think of is to use Javascript inside your
build.xml to read the date of build.xml before and after.
----- Original Message -----
From: "Harkness, David" <>
To: "Ant Users List" <>
Sent: Friday, June 20, 2003 1:28 AM
Subject: Checking a file for modification during p4sync task


I'm creating a simple "sync" target to synchronize with Perforce, and
I'd like to check to see if a new version of build.xml (which *is* in
the depot) was brought to the client. If it was, I'd like to fail the
build to force the user to do it again. Basically, I want something like

    <attrib file="build.xml" property="build.file.tstamp.before"
    <p4sync view="${depot.root}/..."/>
    <attrib file="build.xml" property="build.file.tstamp.after"
    <condition property="build.file.changed">
        <equals arg1="${build.file.tstamp.before}"
    <fail if="build.file.changed" message="Build file changed --

There are two workarounds I can think of. One is to use the "checksum"
task exactly as above, but this requires hashing the entire build file
twice. Not that bad, but overkill when I just need to know the last
modified time. The second is to copy the file before sync'ing, use the
"filesmatch" condition, and finally delete the copy. Again, it would
work but is also overkill.

I'm hoping there is an "attrib" or "fileattrib" task that I'm not
seeing. I also looked in ant-contrib, but timestampSelector sets the
property to the *file* -- not its timestamp. Also, I see the "uptodate"
task which I could use with the second work-around (copy-test-delete),
but are there cleaner options?


David Harkness
Sony Pictures Digital Networks

P.S. I had nothing to do with the making of Charlies Angles: Full
Throttle. :)

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message