rules_java icon indicating copy to clipboard operation
rules_java copied to clipboard

Add jmods to jdk targets

Open Sineaggi opened this issue 2 years ago • 0 comments

One of the features of the jlink command is to allow cross-targetting of jlinked jres. For example, the host jre can target another os/arch via host_jdk/bin/jlink --module-path target_jdk/jmods.

One solution is to add the jmods directory as a filegroup, similar to bin lib include and conf. I've made a PR with this addition here https://github.com/bazelbuild/rules_java/pull/135. You would then use it like args.add("--module-path", ctx.attr.target_jdk[java_common.JavaRuntimeInfo].java_home + "/jmods")

Alternatively we could add jmods to the JavaRuntimeInfo class, considering it already has lib_modules via https://bazel.build/rules/lib/providers/JavaRuntimeInfo#lib_modules, perhaps we could add a File JavaRuntimeInfo.jmods.

Sineaggi avatar Sep 27 '23 15:09 Sineaggi