RFR: 8363980: [macos] Add JDK specific keys/values to Info.plist of embedded runtime

Alexey Semenyuk asemenyuk at openjdk.org
Wed Oct 29 14:45:32 UTC 2025


On Wed, 29 Oct 2025 01:32:50 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

> - Added JDK specific keys/values to Info.plist of embedded runtime.
> - Modified `setFakeRuntime()` not to include `bin` folder. By default it was always included, but generated embedded runtime by default does not have `bin` folder. As a result `CustomInfoPListTest` failed.
> - Updated  `CustomInfoPListTest` to test Info.plist with `bin` folder.

Changes requested by asemenyuk (Reviewer).

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPackagingPipeline.java line 369:

> 367:                 Files.isDirectory(env.resolvedLayout().runtimeDirectory().resolve("bin")) ||
> 368:                 app.isRuntime();
> 369: 

The `writeRuntimeInfoPlist()` action is executed for the `MacBuildApplicationTaskID.RUNTIME_INFO_PLIST` and `MacBuildApplicationTaskID.COPY_RUNTIME_INFO_PLIST` tasks. `MacBuildApplicationTaskID.RUNTIME_INFO_PLIST` doesn't have dependencies. This means it can be executed before the runtime files are available in the output app image. Currently, this is not a problem because jpackage executes tasks synchronously, but eventually it will run them asynchronously, and the `Files.isDirectory(...)` test will fail.

The plist template should be selected at the configuration phase, not the bundling phase. However, this will require knowing/guessing if jlink will create native commands in the "bin" directory from its command line. It is straightforward if it boils down to testing whether it has the "--strip-native-commands" option. This is what we do when we test if jlink options are correct for the Apple App Store, right? [Test for "--strip-native-commands" in DeployParams.java](https://github.com/openjdk/jdk/blob/2c07214d7c075da5dd4a4e872aef29f58cef2bae/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java#L277)

I'd suggest adding `boolean jdk.jpackage.internal.model.RuntimeBuilder.withNativeCommands()` method. Then  the code will be:

final var useRuntimeInfoPlist = app.isRuntime() || app.runtimeBuilder().orElseThrow().withNativeCommands();


Alternatively, you may add the `BuildApplicationTaskID.RUNTIME` task as a dependency for the `MacBuildApplicationTaskID.RUNTIME_INFO_PLIST` task. However, this is a less preferable solution.

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

PR Review: https://git.openjdk.org/jdk/pull/28033#pullrequestreview-3393972142
PR Review Comment: https://git.openjdk.org/jdk/pull/28033#discussion_r2473538432


More information about the core-libs-dev mailing list