[JGIT PATCH 1/3] Make all files in our JAR have the same timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 .../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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux