Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
java-17-openjdk
reproducible-javadoc-timestamp.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File reproducible-javadoc-timestamp.patch of Package java-17-openjdk
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -213,6 +213,12 @@ public class HtmlConfiguration extends BaseConfiguration { } docletVersion = v; + if (System.getenv("SOURCE_DATE_EPOCH") != null) { + startTime = new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); + } else { + startTime = new Date(); + } + conditionalPages = EnumSet.noneOf(ConditionalPage.class); } protected void initConfiguration(DocletEnvironment docEnv, @@ -223,7 +229,7 @@ public class HtmlConfiguration extends BaseConfiguration { } private final Runtime.Version docletVersion; - public final Date startTime = new Date(); + public final Date startTime; @Override public Runtime.Version getDocletVersion() { --- 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 @@ -33,6 +33,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.TimeZone; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; @@ -265,6 +266,9 @@ public class Head extends Content { if (showTimestamp) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (System.getenv("SOURCE_DATE_EPOCH") != null) { + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + } tree.add(HtmlTree.META("dc.created", dateFormat.format(generatedDate))); } @@ -298,7 +302,14 @@ public class Head extends Content { String text = "Generated by javadoc"; // marker string, deliberately not localized text += " (" + docletVersion.feature() + ")"; if (timestamp) { - text += " on " + now; + text += " 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