RFR: 8278766: Enable OpenJDK build support for reproducible jars and jmods using --date

Magnus Ihse Bursie ihse at openjdk.java.net
Fri Dec 17 16:32:26 UTC 2021


On Fri, 17 Dec 2021 13:51:28 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

>> make/common/MakeBase.gmk line 145:
>> 
>>> 143: # If reproducible builds are enabled then set SOURCE_DATE_ISO_8601 string variable
>>> 144: ifeq ($(ENABLE_REPRODUCIBLE_BUILD), true)
>>> 145:   SOURCE_DATE_ISO_8601 := $(shell $(DATE) --utc --date="@$(SOURCE_DATE_EPOCH)" +"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null)
>> 
>> This should be set up by the configure script. Look for where we are currently doing the SOURCE_DATE_EPOCH stuff.
>> 
>> Also consider the possibility to *just* use this variable, and pass it on to jar if it is present, and not if it's missing. That way you can get rid of the redundant boolean variable.
>
> @magicus I looked at that, but the problem is SOURCE_DATE_EPOCH is set in InitSupport.gmk depending on whether SOURCE_DATE=="updated" : https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/make/InitSupport.gmk#L315
> I also couldn't add it in InitSupport.gmk because that marco is not included from every place SetupJarArchive is resolved.
> Thoughts?

Oh, that's ... interesting. (I'm pretty sure I wrote that code myself :))

I still think it would be good to keep the new code close to the old. If we set SOURCE_DATE to "updated", I think that should reflect in SOURCE_DATE_ISO_8601 as well. Maybe it does by the current design, but if it does, it could be more obvious.

I'm sorry I don't have any ready-made suggestion. :( I'm really on vacation now and can't really dive into this, so if you can't find any better solution, then this'll have to do.

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

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



More information about the build-dev mailing list