gradlex-org/java-module-dependencies

[Maybe] Attach module name as capability through metadata rule

jjohannes opened this issue · 2 comments

...this would make it visible in build scans. Also conceptually, the Module Name can be regarded as a Capability.

With the current release, the Module Name is already attached to dependencies declared in the build using because(). This already solves half of this issue.

Using a metadata rule is not as easy as I initially thought:

  • Using the Module Name from the mapping might not be possible at all, because some mappings can be provided late in the build configuration through the extension. But metadata rules need to isolate their values early. It is not really supported to configure metadata rules through extensions.
  • I would be better to use the real Module Name from the Jar file. This would mean that the Jar itself would need to be considered part of the Metadata. This may have performance concerns, but in the end things are cached and Jars are downloaded at some point anyway. It should be possible to access the Jar through a ComponentMetadataSupplier. But an issue will be, most likely, that the Jars are transformed later by the extra-java-module-info plugin.

It does not look like there is a good consistent solution for this "nice to have" feature.

Closing, as I do not see a good technical solution for this at the moment (and it is only a 'nice to have').