Browse Source

Store the modification time of the files inside the ZIP file.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267706 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
bc4dee0c5c
2 changed files with 5 additions and 3 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  2. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -98,7 +98,7 @@ public class Jar extends Zip {
InputStream in = this.getClass().getResourceAsStream(s); InputStream in = this.getClass().getResourceAsStream(s);
if ( in == null ) if ( in == null )
throw new BuildException ( "Could not find: " + s ); throw new BuildException ( "Could not find: " + s );
zipFile(in, zOut, "META-INF/MANIFEST.MF");
zipFile(in, zOut, "META-INF/MANIFEST.MF", System.currentTimeMillis());
} }
} }




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

@@ -161,10 +161,12 @@ public class Zip extends MatchingTask {
{ {
} }


protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath)
protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath,
long lastModified)
throws IOException throws IOException
{ {
ZipEntry ze = new ZipEntry(vPath); ZipEntry ze = new ZipEntry(vPath);
ze.setTime(lastModified);


/* /*
* XXX ZipOutputStream.putEntry expects the ZipEntry to know its * XXX ZipOutputStream.putEntry expects the ZipEntry to know its
@@ -222,7 +224,7 @@ public class Zip extends MatchingTask {
throws IOException throws IOException
{ {
FileInputStream fIn = new FileInputStream(file); FileInputStream fIn = new FileInputStream(file);
zipFile(fIn, zOut, vPath);
zipFile(fIn, zOut, vPath, file.lastModified());
fIn.close(); fIn.close();
} }
} }

Loading…
Cancel
Save