RFR: 8238650: Allow to override buildDate with SOURCE_DATE_EPOCH

John Neffenger jgneff at openjdk.java.net
Wed Apr 14 12:32:34 UTC 2021


On Tue, 9 Mar 2021 03:11:48 GMT, Bernhard M. Wiedemann <github.com+637990+bmwiedemann at openjdk.org> wrote:

> When linking shared libraries, ensure that .o files are listed in deterministic order - i.e. `sort(glob(*.c))` and check if individual .c or .o files vary between builds.

Wow, that tip was priceless! Thank you, Bernhard. It took forever to figure out *where* to add it, but simply adding `.sort()` to the list of object files for the linker did the trick:


index 8f1e04a833..9181ccc7fb 100644
--- a/buildSrc/src/main/groovy/com/sun/javafx/gradle/LinkTask.groovy
+++ b/buildSrc/src/main/groovy/com/sun/javafx/gradle/LinkTask.groovy
@@ -49,7 +49,7 @@ class LinkTask extends DefaultTask {
                 args("$lib");
             }
             // Exclude parfait files (.bc)
-            args(objectDir.listFiles().findAll{ !it.getAbsolutePath().endsWith(".bc") });
+            args(objectDir.listFiles().sort().findAll{ !it.getAbsolutePath().endsWith(".bc") });
             if (project.IS_WINDOWS) {
                 args("/out:$lib");
             } else {


We have reproducible builds! (Well, we have them on Linux, at least, and only after running `strip-nondeterminism` on the JMOD files, but that's still major progress.) I'll follow up with a pull request after checking whether I can get reproducible builds on macOS and Windows, too.

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

PR: https://git.openjdk.java.net/jfx/pull/99


More information about the openjfx-dev mailing list