FAQ
Repository: ant
Updated Branches:
   refs/heads/master 8e87ef9e6 -> 3c37952d6


<zip> up-to-date check doesn't work properly on NTFS

https://bz.apache.org/bugzilla/show_bug.cgi?id=59562

Patch by Gilles QUERRET


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0edf3ca2
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0edf3ca2
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0edf3ca2

Branch: refs/heads/master
Commit: 0edf3ca2524323395d9de340dc1927cb5f3ee267
Parents: 5c24a75
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Thu May 19 06:31:42 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Thu May 19 06:31:42 2016 +0200

----------------------------------------------------------------------
  CONTRIBUTORS | 1 +
  WHATSNEW | 4 ++++
  contributors.xml | 4 ++++
  src/etc/testcases/taskdefs/zip.xml | 19 +++++++++++++++++++
  src/main/org/apache/tools/ant/taskdefs/Zip.java | 9 +++++++--
  .../org/apache/tools/ant/taskdefs/ZipTest.java | 8 ++++++++
  6 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 74d6c63..8e47e05 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -136,6 +136,7 @@ Georges-Etienne Legendre
  Gero Vermaas
  Gerrit Riessen
  Gilbert Rebhan
+Gilles Querret
  Gilles Scokart
  Glenn McAllister
  Glenn Twiggs

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 68338fc..e01128c 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -15,6 +15,10 @@ Fixed bugs:
   * <get>'s quiet attribute was broken, it didn't suppress any messages.
     Bugzilla Report 59379

+ * <zip>'s check whether an archive is already up-to-date failed on
+ NTFS filesystems and re-created archives more often than necessary.
+ Bugzilla Report 59562
+
  Other changes:
  --------------


http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/contributors.xml
----------------------------------------------------------------------
diff --git a/contributors.xml b/contributors.xml
index 85066b7..2bfa1b0 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -570,6 +570,10 @@
    </name>
    <name>
      <first>Gilles</first>
+ <last>Querret</last>
+ </name>
+ <name>
+ <first>Gilles</first>
      <last>Scokart</last>
    </name>
    <name>

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/etc/testcases/taskdefs/zip.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/zip.xml b/src/etc/testcases/taskdefs/zip.xml
index 4fa6de6..61a54a3 100644
--- a/src/etc/testcases/taskdefs/zip.xml
+++ b/src/etc/testcases/taskdefs/zip.xml
@@ -283,5 +283,24 @@
      <zip destFile="${output}/test3.zip" basedir="${output}/ziptest" update="true"/>
    </target>

+ <target name="testRegexpMapper1">
+ <mkdir dir="${output}/regexp.src"/>
+ <touch file="${output}/regexp.src/file1"/>
+ <zip destFile="${output}/regexp.zip">
+ <mappedresources>
+ <fileset dir="${output}/regexp.src" includes="file1" />
+ <regexpmapper from="^(([a-z][a-z]).*)" to="\2/\1.r" />
+ </mappedresources>
+ </zip>
+ </target>
+ <target name="testRegexpMapper2">
+ <sleep seconds="3" />
+ <zip destFile="${output}/regexp.zip">
+ <mappedresources>
+ <fileset dir="${output}/regexp.src" includes="file1" />
+ <regexpmapper from="^(([a-z][a-z]).*)" to="\2/\1.r" />
+ </mappedresources>
+ </zip>
+ </target>

  </project>

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/main/org/apache/tools/ant/taskdefs/Zip.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java
index ddc9bd4..91e28b9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Zip.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java
@@ -78,7 +78,11 @@ import org.apache.tools.zip.ZipOutputStream.UnicodeExtraFieldPolicy;
   */
  public class Zip extends MatchingTask {
      private static final int BUFFER_SIZE = 8 * 1024;
- private static final int ROUNDUP_MILLIS = 1999; // 2 seconds - 1
+ /**
+ * The granularity of timestamps inside a ZIP archive.
+ */
+ private static final int ZIP_FILE_TIMESTAMP_GRANULARITY = 2000;
+ private static final int ROUNDUP_MILLIS = ZIP_FILE_TIMESTAMP_GRANULARITY - 1;
      // CheckStyle:VisibilityModifier OFF - bc

      protected File zipFile;
@@ -1548,7 +1552,8 @@ public class Zip extends MatchingTask {
          final Resource[] rs = selectFileResources(initial);
          Resource[] result =
              ResourceUtils.selectOutOfDateSources(this, rs, mapper,
- getZipScanner());
+ getZipScanner(),
+ ZIP_FILE_TIMESTAMP_GRANULARITY);
          if (!doFilesonly) {
              final Union u = new Union();
              u.addAll(Arrays.asList(selectDirectoryResources(initial)));

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
index 5a7a359..efa9f77 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -297,4 +297,12 @@ public class ZipTest {
          }
      }

+ @Test
+ public void testRegexpMapper() throws IOException {
+ buildRule.executeTarget("testRegexpMapper1");
+ File testFile = new File(buildRule.getOutputDir(), "regexp.zip");
+ long l = testFile.lastModified();
+ buildRule.executeTarget("testRegexpMapper2");
+ assertEquals(l, testFile.lastModified());
+ }
  }

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupnotifications @
categoriesant
postedMay 13, '16 at 5:55p
activeMay 19, '16 at 4:40a
posts5
users1
websiteant.apache.org

1 user in discussion

Bodewig: 5 posts

People

Translate

site design / logo © 2017 Grokbase