On Tue, 20 May 2025 00:47:09 GMT, Alexander Matveev <almat...@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/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties
 line 45:

> 43: resource.app-info-plist=Application Info.plist
> 44: resource.runtime-info-plist=Java Runtime Info.plist
> 45: resource.runtime-image-info-plist=Java Runtime Bundle Info.plist

`resource.runtime-bundle-info-plist` would be a better name as the list file 
belongs to a bundle, not the image.

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties
 line 88:

> 86: message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" 
> failure is missing Xcode with command line developer tools. Install Xcode 
> with command line developer tools to see if it resolves the problem.
> 87: message.runtime-image-invalid=Provided runtime image at "{0}" is invalid 
> or corrupted.
> 88: message.runtime-image-invalid.advice=Runtime image should be valid JDK 
> bundle or JDK image.

We need negative test cases for these new error conditions.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25314#discussion_r2098422966
PR Review Comment: https://git.openjdk.org/jdk/pull/25314#discussion_r2098425687

Reply via email to