On Mon, 9 Dec 2024 18:15:24 GMT, Alexey Semenyuk <asemen...@openjdk.org> wrote:

>> @alexeysemenyukoracle Do you mean it would be OK to re-define `ALL-DEFAULT` 
>> to not include `jdk.jlink` for runtime images? Would that be OK in general 
>> for `jpackage`?
>
> I meant the use of `jdk.internal.module.ModulePath` can be replaced with 
> public API in `JLinkBundlerHelper.java`. Sorry for the confusion.
> 
> Can test if jlink tool is available as an alternative to importing 
> `jdk.tools.jlink.internal.LinkableRuntimeImage` from jpackage:
> 
> 
> private static final boolean LINKABLE_RUNTIME = 
> ToolProvider.findFirst("jlink").isPresent();
> 
> 
> UPD: Oh, this will work only for runtime created from runtime built with 
> `--enable-linkable-runtime` flag ("root" runtime) and will not work for the 
> "root" runtime)

private static final boolean LINKABLE_RUNTIME = 
ToolProvider.findFirst("jlink").isPresent();


Sorry, this isn't the same. It would always be true. JEP 493 enabled build or 
not. I can duplicate what `LinkableRuntimeImage.isLinkableRuntime()` [does 
](https://github.com/openjdk/jdk/blob/cc628a133e471e7edf07831ff386f0eaf57e9bff/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/LinkableRuntimeImage.java#L54-L61)
 in order to determine that without the API, but that's not nice either 
(duplicated code).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22644#discussion_r1876478677

Reply via email to