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

Mandy Chung mchung at openjdk.org
Tue Apr 16 17:48:06 UTC 2024


On Wed, 3 Apr 2024 22:31:39 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move CreateLinkableRuntimePlugin to build folder
>>   
>>   Keep runtime link supporting classes in package
>>   jdk.tools.jlink.internal.runtimelink
>
> Thanks for the investigation w.r.t. extending jimage.  It does not seem worth the effort in pursuing the support of adding resources to an existing jimage file.   To me, putting the diff data under `lib` directory as a private file is a simpler and acceptable solution.   It allows the second jlink invocation to avoid the plugin pipeline if the per-module metadata is generated in normal jlink invocation.
> 
> (An observation: The current implementation requires the diffs to be generated as a plugin.  For this approach, it may be possible to implement with a separate main class that calls JLink API and generates the diffs.)

> What would you (and @mlchung) think of having jlink generate lib/runtime-image-link.delta as a step between the pipeline and image generation?

I have similar thought before I went on vacation last week and also think that this would allow this be further simplified to one single jlink invocation to produce a linkable image.

In `ImageFileCreator::generateJImage`, after the plugin pipeline, it already adds a step to record the per-module meta information as additional resources.   The delta file can be generated after that comparing the original resource pool with the transformed resource pool.  I believe `allContent` has the original content. 

If it is a single jlink step to produce a linkable image (generate the delta file after the plugin pipeline before generating the image), we might be able to get rid of `--ignore-modified-runtime` by storing a copy of conf files in the delta file and the original conf files will be used when the linkable image is used to create a new runtime image. 

[An observation from the above, it might be possible to generate the delta file and insert in the jimage :-)  This might be a bonus.  ]

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

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


More information about the core-libs-dev mailing list