ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xxx Yyy <>
Subject New COPY granularity breaks builds on Windows 2000
Date Tue, 08 Mar 2005 16:11:22 GMT
I looked, but didn't find any discussion on the new granularity
FileUtils.getFileTimestampGranularity.  This is messing up my builds

If you are on Windows and you run two COPY operations within two
seconds of each other, the second COPY will be skipped.

<project default="x">
  <target name="x">
    <touch file="aaa"/>
    <copy file="aaa" tofile="bbb"/>
    <sleep seconds="1"/>
    <touch file="aaa"/>
    <copy file="aaa" tofile="bbb"/>

G:\temp>ant -verbose
Apache Ant version 1.6.2 compiled on July 16 2004
Buildfile: build.xml
Detected Java version: 1.4 in: C:\util\jdk\1.4.2\jre
Detected OS: Windows 2003
parsing buildfile G:\temp\build.xml with URI =
Project base dir set to: G:\temp
 [property] Loading Environment env.
Build sequence for target `x' is [x]
Complete build sequence is [x, ]

     [copy] Copying 1 file to G:\temp
     [copy] Copying G:\temp\aaa to G:\temp\bbb
    [sleep] sleeping for 1000 milliseconds
     [copy] G:\temp\aaa omitted as G:\temp\bbb is up to date.

Total time: 3 seconds

The problem stems from this code in

    public long getFileTimestampGranularity() {
        if (Os.isFamily("dos")) {
        } else {
            return 0;

This is a very poor test.  I guess there's a limitted granularity of
timestamps on FAT formatted disks.  But this test is assuming that any
drive under DOS or Windows is FAT formatted.

My build files have this pattern:

   <make a temporary copy of file-A>
   <work on temporary copy, growing and changing it>
   <when work is complete, replace master copy with temporary>

If the work takes more than two seconds (or build is run on other os,
unix for example), then the ANT COPY works.  If the work completes in
under two seconds on Windows, ANT COPY fails.

Temporary work-around is to override the granularity attribute on COPY.
 But the root cause of the problem (bad test in FileUtils) needs to be

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

View raw message