RFR: 8311302: Allow for jlinking a custom runtime without packaged modules being present [v8]

Mandy Chung mchung at openjdk.org
Tue Nov 28 19:25:10 UTC 2023


On Thu, 23 Nov 2023 18:26:58 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> Those are now being filtered (using exclude-resource) prior it being processed by the TRANSFORMER or ADDER phases. Furthermore, it prevents those classes to populate if plug-ins that generated them aren't used. This also removes the need to actually modify any of the existing plugins.

This is a clever idea.  I think we can express this via Plugin API as each plugin knows what contents it adds.  Instead of hardcoding the `exclude-resources` pattern in `TaskHelper::getPluginsConfig`, it can construct the list from `Plugin::excludeResourcesPattern`. 

> The option --unlock-run-image to get equivalence between a link using packaged modules and run-time based link is now hidden (similar to --keep-packaged-modules). This is really advanced usage and doesn't need a prominent place in jlink --help.

I would suggest to keep this as an internal/unsupported option for now.  Give some time to get customer feedback and reevaluate this if needed. i.e. `--unlock-run-image` won't show in the help output and the error message won't mention this option like this:


Error: /path/to/jdk/conf/net.properties has been modified.


Comments on the CSR:

1.  `Plugin` is an internal API and so no need to document `Plugin::isHidden` in the CSR.

2. If we agree to keep `--unlock-run-image` option as internal/unsupported option, it can be dropped from the CSR.

3.  About the message  'jmods' folder not present, performing a run-time image based link.

Instead of saying "performing a run-time image based link", it may be helpful for the users to know what plugins are applied in the resulting image.  Also we can say "The default module path: `jmods` not present".   For example:

The default module path: `$java.home/jmods` not present.   Use --verbose to show the full list of plugin options applied.

The `--verbose` option can include the options for the plugins accumulated with the run-time image (such as `--strip-debug --vendor-bug-url xxx`)

4. Suggested error message for recursive linking:

$ ./bin/jlink --add-modules java.base --output ./build/second-stage-link-java.base
Error: Module path to the JDK package modules must be specified.   Run-time image based linking is not supported as $java.home was created from a run-time image but not packaged modules.

or something like that.

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

PR Comment: https://git.openjdk.org/jdk/pull/14787#issuecomment-1830528390


More information about the core-libs-dev mailing list