Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 9 years ago
parent
commit
3c37952d69
6 changed files with 43 additions and 2 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -0
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +19
    -0
      src/etc/testcases/taskdefs/zip.xml
  5. +7
    -2
      src/main/org/apache/tools/ant/taskdefs/Zip.java
  6. +8
    -0
      src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java

+ 1
- 0
CONTRIBUTORS View File

@@ -136,6 +136,7 @@ Georges-Etienne Legendre
Gero Vermaas
Gerrit Riessen
Gilbert Rebhan
Gilles Querret
Gilles Scokart
Glenn McAllister
Glenn Twiggs


+ 4
- 0
WHATSNEW View File

@@ -21,6 +21,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:
--------------



+ 4
- 0
contributors.xml View File

@@ -568,6 +568,10 @@
<first>Gilbert</first>
<last>Rebhan</last>
</name>
<name>
<first>Gilles</first>
<last>Querret</last>
</name>
<name>
<first>Gilles</first>
<last>Scokart</last>


+ 19
- 0
src/etc/testcases/taskdefs/zip.xml View File

@@ -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>

+ 7
- 2
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -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)));


+ 8
- 0
src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java View File

@@ -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());
}
}

Loading…
Cancel
Save