[JGIT PATCH 1/3] Make all files in our JAR have the same timestamp
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Sep 2, 2008, 16:28 UTC
- Message-ID
- <1220372892-15423-1-git-send-email-spearce@spearce.org>
When we link together our classes into a JAR we want to use the same timestamp for all entries in the archive. Using different times from the local filesystem is fairly meaningless.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- .../org/spearce/jgit/pgm/build/JarLinkUtil.java | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java index 46ae0ea..929ee55 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/build/JarLinkUtil.java @@ -93,6 +93,8 @@ public static void main(final String[] argv) throws IOException { private final Map<String, File> chosenSources = new HashMap<String, File>(); + private long creationTime; + private ZipOutputStream zos; private JarLinkUtil() { @@ -109,6 +111,7 @@ private void run() throws IOException { for (final Map.Entry<String, String> e : files.entrySet()) chosenSources.put(e.getKey(), new File(e.getValue())); + creationTime = System.currentTimeMillis(); zos = new ZipOutputStream(System.out); zos.setLevel(9); @@ -180,9 +183,8 @@ else if (chosenSources.get(pfx + e.getName()) == rootDir) private void appendFile(final File path, final String name) throws IOException { final long len = path.length(); - final long time = path.lastModified(); final InputStream is = new FileInputStream(path); - appendEntry(name, len, time, is); + appendEntry(name, len, creationTime, is); } private void appendEntry(final String name, final long len,
-- 1.6.0.1.207.g020e5