RFR: 8345185: Some tests in test/jdk/tools/jpackage fail with a JDK without JMODs
Severin Gehwolf
sgehwolf at openjdk.org
Mon Dec 9 18:19:38 UTC 2024
On Mon, 9 Dec 2024 18:00:31 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
> > The proposal is to not include jdk.jlink and jdk.jpackage by default on a JDK build with JEP 493 enabled
>
> jpackage can use external runtime through `--runtime-image` cli option and not invoke jlink.
>
> Would you consider adding an error message to jpackage if it detects jlink tool is not available as an alternative to not including jdk.jpackage module in `ALL-DEFAULT`? Seems like a more generic solution.
The `jlink` tool *is* available. Currently, one restriction imposed when JEP 493 got done was to not allow `jdk.jlink` in an *output* image. Technically it could be part, but it's just not allowed (yet) by policy. Some examples:
$ ls ./build/linux-x86_64-server-release/images/jdk/jmods
ls: cannot access './build/linux-x86_64-server-release/images/jdk/jmods': No such file or directory
$ ./build/linux-x86_64-server-release/images/jdk/bin/jlink --help | tail -n2
Capabilities:
Linking from run-time image enabled
$ ./build/linux-x86_64-server-release/images/jdk/bin/jlink --add-modules java.base --output ./build/java.base.img --verbose
Linking based on the current run-time image
java.base jrt:/java.base (run-time image)
Providers:
java.base provides java.nio.file.spi.FileSystemProvider used by java.base
$ ./build/java.base.img/bin/java --list-modules
java.base at 25-internal
$ ./build/linux-x86_64-server-release/images/jdk/bin/jlink --add-modules jdk.jlink --output ./build/jdk.jlink.img --verbose
Error: This JDK does not contain packaged modules and cannot be used to create another image with the jdk.jlink module
So the problem is that `ALL-DEFAULT` includes `jdk.jlink`, because of the ToolProvider API, I think.
The question is how useful do users see the need to have `jdk.jlink` part when they *don't* use the `--runtime-image` option and `jpackage`. Not using `--runtime-image` seems a common use case and the few that need `jdk.jlink` can produce one using the JMODs and use the `--runtime-image` option. What do you think?
> test/jdk/tools/jpackage/share/BasicTest.java line 323:
>
>> 321: return;
>> 322: }
>> 323: }
>
> The better alternative would be to use `@ParameterSupplier` annotation instead of the list of `@Parameter` to dynamically configure the input for testAddModules() test case. You can use https://github.com/openjdk/jdk/blob/master/test/jdk/tools/jpackage/share/ErrorTest.java or https://github.com/openjdk/jdk/blob/cc628a133e471e7edf07831ff386f0eaf57e9bff/test/jdk/tools/jpackage/helpers-test/jdk/jpackage/test/AnnotationsTest.java#L97 as an example.
OK, thank you.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22644#issuecomment-2528986634
PR Review Comment: https://git.openjdk.org/jdk/pull/22644#discussion_r1876468664
More information about the core-libs-dev
mailing list