git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 1/3] Make all files in our JAR have the same timestamp
@ 2008-09-02 16:28 Shawn O. Pearce
  2008-09-02 16:28 ` [JGIT PATCH 2/3] Build jgit.jar and jgit_src.zip alongside jgit CLI wrapper Shawn O. Pearce
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2008-09-02 16:28 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-02 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-02 16:28 [JGIT PATCH 1/3] Make all files in our JAR have the same timestamp Shawn O. Pearce
2008-09-02 16:28 ` [JGIT PATCH 2/3] Build jgit.jar and jgit_src.zip alongside jgit CLI wrapper Shawn O. Pearce
2008-09-02 16:28   ` [JGIT PATCH 3/3] Add a tiny "jgit version" program Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).