RFR: 8264449: Enable reproducible builds with SOURCE_DATE_EPOCH [v8]

John Neffenger jgneff at openjdk.org
Fri Jan 13 23:13:26 UTC 2023


On Wed, 11 Jan 2023 23:00:22 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> John Neffenger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits:
>> 
>>  - Add '--date' argument for deterministic JMOD files
>>  - Merge branch 'master' into allow-reproducible-builds
>>  - Merge branch 'master' into allow-reproducible-builds
>>  - Comment out 'jmod --date' until building on JDK 19
>>    
>>    Support for the 'jmod --date' option was added to JDK 19 starting
>>    with the 19+2 early-access build, and it was backported to JDK 17
>>    starting with release 17.0.3. It is not available in JDK 18.
>>  - Merge 'master' into allow-reproducible-builds
>>  - Make minimal changes for new '--date' option
>>  - Add new '--date' option to JMOD task
>>  - Add '--source-date' option to JMOD task
>>  - Get build timestamp in UTC and set ZIP timestamps
>>    
>>    Create the build timestamp as a zoned date and time in UTC instead
>>    of a local date and time. If SOURCE_DATE_EPOCH is defined, set the
>>    last modification time of ZIP and JAR entries to the local date and
>>    time in UTC of the instant defined by SOURCE_DATE_EPOCH.
>>    
>>    Add a comment as a reminder to make JMOD files deterministic when
>>    the following enhancements are complete:
>>    
>>    * Enable deterministic file content ordering for Jar and Jmod
>>      https://bugs.openjdk.java.net/browse/JDK-8276764
>>      https://github.com/openjdk/jdk/pull/6395
>>    
>>    * Enable jar and jmod to produce deterministic timestamped content
>>      https://bugs.openjdk.java.net/browse/JDK-8276766
>>      https://github.com/openjdk/jdk/pull/6481
>>  - Merge branch 'master' into allow-reproducible-builds
>>  - ... and 7 more: https://git.openjdk.org/jfx/compare/a35c3bf7...1e4c083b
>
> build.gradle line 5573:
> 
>> 5571:                         args(srcLegalDir)
>> 5572:                         if (sourceDateEpoch != null) {
>> 5573:                             args("--date", buildTimestamp)
> 
> Since the minimum boot JDK for building JavaFX is still JDK 17 GA, you will need to qualify this with a check for `if (jdk19OrLater)`. See the following for a pattern to use to define that flag:
> 
> https://github.com/openjdk/jfx/blob/1e4c083b90281e91b1e9cbbc615401e89bb933b1/build.gradle#L699-L704
> 
> Btw, the comment in that block should read "based on whether we are _building_ on JDK 18 or later".

Done. The `jmodTask` checks for JDK 19 or later. Let me know if you think we should add the `--date` argument also for versions of JDK 17 later than 17.0.4. My tests indicate that JDK 17.0.5, for example, has enough back-ported features to get reproducible builds of JavaFX in some limited circumstances. I figured it wasn't worth it, though, considering we'll need JDK 20 eventually, anyway.

-------------

PR: https://git.openjdk.org/jfx/pull/446


More information about the openjfx-dev mailing list