Open LunNova opened 4 years ago
Still broken under 6.7.1, moved the repro to this tag https://github.com/MinimallyCorrect/Mapping/tree/gradle-13044, main now has a workaround for this.
(Worked around this issue by making a temporary local maven repo for the dependency, immediately ran into another issue with chained transformers not seeming to work which I'm still trying to make an MVCE for. :/)
Expected Behavior
Using component metadata rules to change attributes should work for any dependency
Current Behavior
Does not appear to work for a SelfResolvingDependency
Context
Have a few dependencies in implementation. Some are normal maven modules, one's a SelfResolvingDependency which gets generated by merging two downloaded jars. For legal reasons the generated jar can't be hosted as a maven module, it has to be created on-demand.
A gradle plugin which remaps jars (changing names in them based on a mapping file) is used to transform any jars which need mapped based on their
dev.minco.mapped.net.minecraft
attribute. The default value of this attribute is "UNKNOWN" and anAttributeCompatibilityRule
is used to make that compatible with any target, ensuring that dependency without this metadata is not mapped.The generated dependency actually should have a value for this attribute, so the component metadata rule is used to add it:
The rule appears to run, but the default value for the attribute of "UNKNOWN" still gets passed to the compatibility check resulting in no transform being ran:
Using the same rule to target a module from a maven dependency does set the attribute, causing a build failure (expected, proves it's working, haven't actually added the transformer yet):
Steps to Reproduce
Use the MappingTest subfolder at https://github.com/MinimallyCorrect/Mapping/tree/gradle-13044
Your Environment
Build scan URL: https://scans.gradle.com/s/d3gx3fejgdqbw
Guess the suggested resolution here might involve not using SelfResolvingDependency, but that seems to leave us with no way to generate a dependency on demand. A FilesCollection as a dependency uses DefaultSelfResolvingDependency internally, although you're also left with group/module/version unset, so that doesn't help at all.