Package list findbugs / 0de34b0 debian / patches / 0015-reproducibility.patch
0de34b0

Tree @0de34b0 (Download .tar.gz)

0015-reproducibility.patch @0de34b0raw · history · blame

Description: Make the timestamps reproducible
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/java/edu/umd/cs/findbugs/Version.java
+++ b/src/java/edu/umd/cs/findbugs/Version.java
@@ -92,6 +92,12 @@
         SimpleDateFormat eclipseDateFormat = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH);
         SimpleDateFormat releaseDateFormat = new SimpleDateFormat(UpdateChecker.PLUGIN_RELEASE_DATE_FMT, Locale.ENGLISH);
         Date now = new Date();
+        if (System.getenv("SOURCE_DATE_EPOCH") != null) {
+            now = new Date(Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")) * 1000L);
+            dateFormat.setTimeZone(java.util.TimeZone.getTimeZone("UTC"));
+            eclipseDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("UTC"));
+            releaseDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("UTC"));
+        }
         COMPUTED_DATE = dateFormat.format(now);
         COMPUTED_ECLIPSE_DATE = eclipseDateFormat.format(now);
         String tmp =  releaseDateFormat.format(now);