RFR: 8264449: Enable reproducible builds with SOURCE_DATE_EPOCH
John Neffenger
jgneff at openjdk.java.net
Thu Apr 1 15:48:08 UTC 2021
On Wed, 31 Mar 2021 23:08:38 GMT, John Neffenger <jgneff at openjdk.org> wrote:
>> I recommend trying this with the following gradle flags, to match the settings for production builds:
>>
>> -PCONF=Release -PPROMOTED_BUILD_NUMBER=NNN -PHUDSON_BUILD_NUMBER=MMM -PHUDSON_JOB_NAME=jfx -PCOMPILE_WEBKIT=true -PCOMPILE_MEDIA=true -PBUILD_LIBAV_STUBS=true
>>
>> where `NNN` is the promoted build number that is being built (usually taken from the repo tag) and `MMM` is the CI build number. You can just pick any two positive numbers for your test builds.
>>
>> Note that this will build the native media libraries and the native webkit library.
>
>> I recommend trying this with the following gradle flags, to match the settings for production builds:
>
> Thanks, Kevin. Good news so far. I'm posting the Linux results while I run the macOS and Windows builds.
>
> #### Linux
>
> I ran the following commands twice, moving the `build` directory to `build1` and then `build2` to save their output:
>
> $ bash gradlew clean
> $ bash gradlew -PCONF=Release -PPROMOTED_BUILD_NUMBER=5 \
> -PHUDSON_BUILD_NUMBER=101 -PHUDSON_JOB_NAME=jfx \
> -PCOMPILE_WEBKIT=true -PCOMPILE_MEDIA=true \
> -PBUILD_LIBAV_STUBS=true sdk jmods javadoc
>
> Then I changed the Hudson job number with `-PHUDSON_BUILD_NUMBER=102`, ran the build a third time, and moved `build` to `build3`. I also ran `strip-nondeterminism` as shown in the first comment of this pull request.
>
> The first result is as hoped, and the second result is as expected:
>
> $ diff -qr build1 build2
> $ diff -qr build2 build3
> Files build2/jmods/javafx.base.jmod
> and build3/jmods/javafx.base.jmod
> differ
> Files build2/modular-sdk/modules/javafx.base/com/sun/javafx/runtime/VersionInfo.class
> and build3/modular-sdk/modules/javafx.base/com/sun/javafx/runtime/VersionInfo.class
> differ
> Files build2/modular-sdk/modules_src/javafx.base/com/sun/javafx/runtime/VersionInfo.java
> and build3/modular-sdk/modules_src/javafx.base/com/sun/javafx/runtime/VersionInfo.java
> differ
> Files build2/publications/javafx.base-linux.jar
> and build3/publications/javafx.base-linux.jar
> differ
> Files build2/sdk/lib/javafx.base.jar
> and build3/sdk/lib/javafx.base.jar
> differ
> Files build2/sdk/lib/src.zip
> and build3/sdk/lib/src.zip
> differ
>
> You have to appreciate the irony of adding all this information to the build — the time, the path, even the job number — so that we can uniquely identify a build by its output. Meanwhile, if we didn't add this information, our builds could be uniquely identified by a single Git tag.
There's good news and bad news. Good news first.
#### macOS
The two comparisons of the three builds on macOS were similar to those on Linux:
$ diff -qr build1 build2
$ diff -qr build2 build3
Files build2/jmods/javafx.base.jmod
and build3/jmods/javafx.base.jmod
differ
Files build2/modular-sdk/modules/javafx.base/com/sun/javafx/runtime/VersionInfo.class
and build3/modular-sdk/modules/javafx.base/com/sun/javafx/runtime/VersionInfo.class
differ
Files build2/modular-sdk/modules_src/javafx.base/com/sun/javafx/runtime/VersionInfo.java
and build3/modular-sdk/modules_src/javafx.base/com/sun/javafx/runtime/VersionInfo.java
differ
Files build2/publications/javafx.base-mac.jar
and build3/publications/javafx.base-mac.jar
differ
Files build2/sdk/lib/javafx.base.jar
and build3/sdk/lib/javafx.base.jar
differ
Files build2/sdk/lib/src.zip
and build3/sdk/lib/src.zip
differ
#### Windows
The Windows build, on the other hand, failed to produce identical copies of the media and WebKit shared libraries:
$ diff -qr build1 build2
Files build1/jmods/javafx.media.jmod
and build2/jmods/javafx.media.jmod
differ
Files build1/jmods/javafx.web.jmod
and build2/jmods/javafx.web.jmod
differ
Files build1/modular-sdk/modules_libs/javafx.media/fxplugins.dll
and build2/modular-sdk/modules_libs/javafx.media/fxplugins.dll
differ
Files build1/modular-sdk/modules_libs/javafx.media/glib-lite.dll
and build2/modular-sdk/modules_libs/javafx.media/glib-lite.dll
differ
Files build1/modular-sdk/modules_libs/javafx.media/gstreamer-lite.dll
and build2/modular-sdk/modules_libs/javafx.media/gstreamer-lite.dll
differ
Files build1/modular-sdk/modules_libs/javafx.media/jfxmedia.dll
and build2/modular-sdk/modules_libs/javafx.media/jfxmedia.dll
differ
Files build1/modular-sdk/modules_libs/javafx.web/jfxwebkit.dll
and build2/modular-sdk/modules_libs/javafx.web/jfxwebkit.dll
differ
Files build1/publications/javafx.media-win.jar
and build2/publications/javafx.media-win.jar
differ
Files build1/publications/javafx.web-win.jar
and build2/publications/javafx.web-win.jar
differ
Files build1/sdk/bin/fxplugins.dll
and build2/sdk/bin/fxplugins.dll
differ
Files build1/sdk/bin/glib-lite.dll
and build2/sdk/bin/glib-lite.dll
differ
Files build1/sdk/bin/gstreamer-lite.dll
and build2/sdk/bin/gstreamer-lite.dll
differ
Files build1/sdk/bin/jfxmedia.dll
and build2/sdk/bin/jfxmedia.dll
differ
Files build1/sdk/bin/jfxwebkit.dll
and build2/sdk/bin/jfxwebkit.dll
differ
I didn't bother running the third build with `-PHUDSON_BUILD_NUMBER=102`. I assume CMake would be the same across platforms. I'm hoping it's just a missing `/experimental:deterministic` somewhere for the Windows linker. I'll track it down.
-------------
PR: https://git.openjdk.java.net/jfx/pull/446
More information about the openjfx-dev
mailing list