Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Factory:RISCV
java-11-openjdk
reproducible-javadoc-timestamp.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File reproducible-javadoc-timestamp.patch of Package java-11-openjdk
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java index b227ef5fb8..ac186f4e52 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java @@ -256,6 +256,9 @@ public class Head { */ public Content toContent() { Date now = showTimestamp ? calendar.getTime() : null; + if (now != null && System.getenv("SOURCE_DATE_EPOCH") != null) { + now = new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); + } HtmlTree tree = new HtmlTree(HtmlTag.HEAD); if (showGeneratedBy) { @@ -269,6 +272,9 @@ public class Head { if (showMetaCreated) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (System.getenv("SOURCE_DATE_EPOCH") != null) { + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + } tree.add(HtmlTree.META( (htmlVersion == HtmlVersion.HTML5) ? "dc.created" : "date", dateFormat.format(now))); @@ -298,7 +304,14 @@ public class Head { private Comment getGeneratedBy(boolean timestamp, Date now) { String text = "Generated by javadoc"; // marker string, deliberately not localized if (timestamp) { - text += " ("+ docletVersion + ") on " + now; + text += " ("+ docletVersion + ") on "; + if (System.getenv("SOURCE_DATE_EPOCH") == null) { + text += now; + } else { + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); + fmt.setTimeZone(TimeZone.getTimeZone("UTC")); + text += fmt.format(now); + } } return new Comment(text); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor