JDK-8264449 : Enable reproducible builds with SOURCE_DATE_EPOCH
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: build
  • Affected Version: jfx17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-03-30
  • Updated: 2023-10-02
  • Resolved: 2023-06-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx21 b23Fixed
Related Reports
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Relates :  
Relates :  
Relates :  
Description
Enable reproducible builds when the SOURCE_DATE_EPOCH environment variable is defined. See the following page for details on defining the variable:

  SOURCE_DATE_EPOCH
  https://reproducible-builds.org/docs/source-date-epoch/

SYSTEM / OS / JAVA RUNTIME INFORMATION

Ubuntu 20.04.2 LTS

  $ uname -srm
  Linux 5.4.0-70-generic x86_64

macOS 11.2.3 (Big Sur)

  $ uname -srm
  Darwin 20.3.0 x86_64

Windows 10 Pro Version 10.0.19042

  $ uname -srm
  CYGWIN_NT-10.0 3.1.7(0.340/5/3) x86_64

Oracle OpenJDK 15.0.2

  $ java --version
  openjdk 15.0.2 2021-01-19
  OpenJDK Runtime Environment (build 15.0.2+7-27)
  OpenJDK 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

Apache Ant 1.10.9

  $ ant -version
  Apache Ant(TM) version 1.10.9 compiled on September 27 2020

STEPS TO REPRODUCE

1. Build the JavaFX SDK libraries, JMOD archives, and API documentation:

  $ bash gradlew clean sdk jmods javadoc

2. Save the first build and then run another clean build:

  $ mv build build1
  $ bash gradlew clean sdk jmods javadoc

3. Save the second build and then compare it with the first:

  $ mv build build2
  $ diff -qr build1 build2

EXPECTED RESULTS

The two builds are identical:

  $ diff -qr build1 build2 | wc -l
  0

If not, the command 'strip-nondeterminism' removes their differences:

  $ strip-nondeterminism -v build?/jmods/*.jmod
  $ diff -qr build1 build2 | wc -l
  0

ACTUAL RESULT

There are 47 files that are different between the two builds:

  $ diff -qr build1 build2 | wc -l
  47

The files that differ have the following file types:

  23  .jar
  12  .so
   7  .jmod
   2  .properties
   1  .zip
   1  .class
   1  .java
  --------------
  47  Total

Running the command 'strip-nondeterminism' on the JAR, JMOD, and ZIP files does not remove all of their differences:

  $ strip-nondeterminism -v $(find build? -name "*.jar")
  $ strip-nondeterminism -v build?/jmods/*.jmod
  $ strip-nondeterminism -v build?/sdk/lib/src.zip

  $ diff -qr build1 build2 | grep '\.jar'
  Files build1/publications/javafx.base-linux.jar and
        build2/publications/javafx.base-linux.jar differ
  Files build1/publications/javafx.graphics-linux.jar and
        build2/publications/javafx.graphics-linux.jar differ
  Files build1/sdk/lib/javafx.base.jar and
        build2/sdk/lib/javafx.base.jar differ

  $ diff -qr build1 build2 | grep '\.jmod'
  Files build1/jmods/javafx.base.jmod and
        build2/jmods/javafx.base.jmod differ
  Files build1/jmods/javafx.graphics.jmod and
        build2/jmods/javafx.graphics.jmod differ

  $ diff -qr build1 build2 | grep '\.zip'
  Files build1/sdk/lib/src.zip and
        build2/sdk/lib/src.zip differ

In fact, there are still 22 files that are different after running 'strip-nondeterminism' on all of the supported file types:

  $ diff -qr build1 build2 | wc -l
  22

SOURCE CODE FOR AN EXECUTABLE TEST CASE

N/A

WORKAROUND

None

Comments
Changeset: 0d9dcf38 Author: John Neffenger <jgneff@openjdk.org> Date: 2023-06-20 16:41:52 +0000 URL: https://git.openjdk.org/jfx/commit/0d9dcf38275528e1b621d71631aac5bdb9452110
20-06-2023