RFR: 8370969: --launcher-as-service option is ignored when used with --app-image option
Alexey Semenyuk
asemenyuk at openjdk.org
Thu Oct 30 19:12:08 UTC 2025
- Fix jpackage to handle correctly the `--launcher-as-service` cli option when bundling a native bundle from the predefined app image.
- Rework `LauncherAsServiceVerifier` to make it work with `JPackageCommand` and `PackageTest`. This allows using it in tests when jpackage creates a native bundle from the predefined app image (`--app-image` option).
- Add relevant test cases to `ServiceTest`. The new test cases cover "launcher-as-service" feature for additional launchers.
- Fix `MacHelper.getPackageId()` to make it work when bundling a native bundle from the predefined app image.
Supplementary changes:
- Get rid of "thows IOException" from all method signatures in `CfgTest` and `TKit.traceFileContents()`.
- Format `TKit.createTextFile()` and `TKit.createPropertiesFile()`.
- Add `JPackageCommand.mainLauncherName()`. It returns the same value as `JPackageCommand.name()`, but will fail if called in case or runtime bundling. Replace `JPackageCommand.name()` with `JPackageCommand.mainLauncherName()` where appropriate.
- Add the `PropertyFinder` class, which provides a declarative way to calculate the value of a property that may be sourced from one or a few cli options, a property in an additionl launcher property file, and a value in the app image file (.jpackage.xml).
-------------
Commit messages:
- CfgFile, TKit: get rid of "throws IOException"; TKit: reformat createTextFile() and createPropertiesFile()
- FromParams: fix a bug that "--launcher-as-service" doesn't have any effect on the main launcher when used with the "--app-image" option.
- MacHelper: use PropertyFinder to get the value of the package ID
- ConfigFilesStasher: use LauncherAsServiceVerifier.launcherAsService()
- ServiceTest, LauncherAsServiceVerifier: improve test coverage
- Introduce PropertyFinder to calculate value of properties defined by jpackage command line options, additional launcher property files, and .jpackage.xml file fom the predefeined app image in a uniform way
- JPackageCommand: add mainLauncherName(), launcherNames(); change signature of addLauncherNames(); MacSignVerify: follow-up for addLauncherNames() change; WinShortcutVerifier, LauncherShortcut, LinuxHelper: use JPackageCommand.mainLauncherName(), JPackageCommand.addLauncherNames()
- AdditionalLauncher: add removeProperty()
Changes: https://git.openjdk.org/jdk/pull/28071/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28071&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8370969
Stats: 632 lines in 14 files changed: 480 ins; 42 del; 110 mod
Patch: https://git.openjdk.org/jdk/pull/28071.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28071/head:pull/28071
PR: https://git.openjdk.org/jdk/pull/28071
More information about the core-libs-dev
mailing list