RFR: 8238650: Allow to override buildDate with SOURCE_DATE_EPOCH
Kevin Rushforth
kcr at openjdk.java.net
Thu Feb 27 00:03:39 UTC 2020
On Wed, 29 Jan 2020 08:58:47 GMT, Bernhard M. Wiedemann <github.com+637990+bmwiedemann at openjdk.org> wrote:
> Allow to override buildDate 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 PR was done while working on reproducible builds for openSUSE.
Finally getting to this (sorry for the delay). This seems OK to me, as it is not an intrusive change. I do not think that actually setting this property for production builds is a good idea, so I recommend against that (ultimately that will be up to Gluon or whoever produces builds).
I'll test it once you change it from an env variable to a gradle property.
build.gradle line 542:
> 541:
> 542: def buildDate = System.getenv("SOURCE_DATE_EPOCH") == null ? new java.util.Date() : new java.util.Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")))
> 543: def buildTimestamp = new java.text.SimpleDateFormat("yyyy-MM-dd-HHmmss").format(buildDate)
This should be defined as a gradle property using `defineProperty` like this:
defineProperty("SOURCE_DATE_EPOCH", "")
You can then test for `SOURCE_DATE_EPOCH == ""`
You would pass it into the build via `gradle -PSOURCE_DATE_EPOCH=...`
I also recommend wrapping the line since it's pretty long.
While you are at it, can you add `BUILD_TIMESTAMP` to the list of properties that are logged? Look for `log.quiet`.
-------------
PR: https://git.openjdk.java.net/jfx/pull/99
More information about the openjfx-dev
mailing list