Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264449

Enable reproducible builds with SOURCE_DATE_EPOCH

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • jfx21
    • jfx17
    • javafx
    • b23
    • generic
    • generic

    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

      Attachments

        Issue Links

          Activity

            People

              jgneff John Neffenger
              jgneff John Neffenger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: