1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Add support for SOURCE_DATE_EPOCH to avoid embedding timestamp in .jar
file.
https://reproducible-builds.org/docs/source-date-epoch/
--- a/opentest4j/build.gradle
+++ b/opentest4j/build.gradle
@@ -9,7 +9,14 @@
id 'signing'
}
-Date buildTimeAndDate = new Date()
+// https://reproducible-builds.org/docs/source-date-epoch/
+String source_date_epoch = System.getenv("SOURCE_DATE_EPOCH");
+if (source_date_epoch != null) {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
+}
+Date buildTimeAndDate = source_date_epoch == null ?
+ new Date() :
+ new Date(1000 * Long.parseLong(source_date_epoch))
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
|