ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <levylamb...@tiscali-dsl.de>
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.
Antoine
----- Original Message -----
From: "Harkness, David" <DHarkness@sonypictures.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Friday, June 20, 2003 1:28 AM
Subject: Checking a file for modification during p4sync task


Hello,

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
this:

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

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?

Thanks!

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message