RFR: 8276766: Enable jar and jmod to produce deterministic timestamped content [v4]

John Neffenger jgneff at openjdk.java.net
Thu Nov 25 03:41:06 UTC 2021


On Tue, 23 Nov 2021 20:29:15 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

>> Add a new --source-date <TIMESTAMP> (epoch seconds) option to jar and jmod to allow specification of time to use for created/updated jar/jmod entries. This then allows the ability to make the content deterministic.
>> 
>> Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>
> Andrew Leonard has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
> 
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>

I just tested this pull request by building [my JavaFX pull request][1] on six Linux architectures, and it works beautifully!

First I built this pull request branch of OpenJDK for Linux on the following hardware platforms: amd64 (x86_64), arm64 (aarch64), armhf (armv7l), i386 (i636), ppc64el (ppc64le), and s390x (s390x).

Then I added three lines of Groovy code to the JavaFX `build.gradle` file where it invokes the `jmod` tool:


    if (sourceDateEpoch != null) {
        args("--source-date", sourceDateEpoch)
    }


Then I built JavaFX twice for each of the architectures, with each build on a clean, isolated container created from scratch. The result is 6 architectures × 4,360 files = 26,160 identical files between the two sets of builds. The JMOD archives were the last missing piece for JavaFX, so thank you, Andrew, for completing the puzzle.

By the way, my builds of OpenJDK did not include your `jarjmodorder` branch, yet the order for the entries in the JMOD archives are the same. In fact, I checked my old builds and the entry order has always been the same between builds for the JMOD archives. Only the entry timestamps were different. Is that expected? I mean, although the order is not deterministic, is it expected that they would end up in the same order when the archives are built in the same environment by the same build process?

[1]: https://github.com/openjdk/jfx/pull/446

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

PR: https://git.openjdk.java.net/jdk/pull/6481


More information about the compiler-dev mailing list