Skip to content

Commit 22aed67

Browse files
committed
FOP-2854: Allow to override CreationDate
Allow to override build date with SOURCE_DATE_EPOCH in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. This patch was done while working on reproducible builds for openSUSE.
1 parent eb335e3 commit 22aed67

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ public static Metadata createXMPFromPDFDocument(PDFDocument pdfDoc) {
135135

136136
//Set creation date if not available, yet
137137
if (info.getCreationDate() == null) {
138-
Date d = new Date();
138+
Date d = System.getenv("SOURCE_DATE_EPOCH") == null ?
139+
new Date() :
140+
new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
139141
info.setCreationDate(d);
140142
}
141143

0 commit comments

Comments
 (0)