RFR: 8351073: [macos] jpackage produces invalid Java runtime DMG bundles
Alexander Matveev
almatvee at openjdk.org
Wed May 21 01:47:53 UTC 2025
On Tue, 20 May 2025 16:57:34 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
>> Fixed jpackage to produce valid Java runtimes based on description below:
>>
>> Definitions:
>>
>> - JDK bundle defined as bundle which contains "Contents/Home", "Contents/MacOS/libjli.dylib" and "Contents/Info.plist".
>> - Signed JDK bundle contains all files as JDK bundle + "Contents/_CodeSignature".
>> - JDK image defined as content of "Contents/Home".
>> - Signed JDK image does not exist, since it cannot be signed as bundle.
>>
>> jpackage output based on input:
>>
>> 1. "--runtime-image" points to unsigned JDK bundle and --mac-sign is not provided:
>> - jpackage will copy all files as is from provided path and run ad-hoc codesign.
>>
>> 2. "--runtime-image" points to unsigned JDK bundle and --mac-sign is provided:
>> - jpackage will copy all files as is from provided path and run codesign with appropriate certificate based on same logic as we do for application image.
>>
>> 3. "--runtime-image" points to signed JDK bundle and --mac-sign is not provided:
>> - jpackage will copy all files as is from provided path including "Contents/_CodeSignature" to preserve signing.
>>
>> 4. "--runtime-image" points to signed JDK bundle and --mac-sign is provided:
>> - jpackage will copy all files as is from provided path including "Contents/_CodeSignature" and will re-sign bundle with appropriate certificate.
>>
>> 5. "--runtime-image" points to JDK image and --mac-sign is not provided:
>> - jpackage will check for libjli.dylib presence in "lib" folder.
>> - Create JDK bundle by putting all files from provided path to "Contents/Home", libjli.dylib from "lib" to "Contents/MacOS/libjli.dylib" and create default "Contents/Info.plist" similar to what we do for runtime in application image.
>> - Ad-hoc signing will done.
>>
>> 6. "--runtime-image" points to JDK image and --mac-sign is provided:
>> - 2 first steps from 5 and certificate signing will be done.
>
> src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java line 199:
>
>> 197: }
>> 198: return version;
>> 199: },
>
> I guess, this is a workaround for the case when the version comes from JDK's release file. This is the wrong place for this workaround. It should be a part of the code reading version from JDK's release file.
Yes, this is workaround when the version comes from JDK's release file. In this case name will be customeJDK-25.0.0.0 for example if we change it when we read version form file. Other platform do not need it. Only PRODUCT_VERSION in MSI needs to be 2 or 4 components, so I think it is correct location for it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25314#discussion_r2099140330
More information about the core-libs-dev
mailing list