is there a way to check the actual requested attri...
# dependency-management
r
is there a way to check the actual requested attributes in a ComponentMetadataRule? I want to use ComponentMetadata rules to disable transitive dependencies at all, but keep it for now for my codequality configurations like
checkstyle
and
spotless
. I wonder if there's a way or if I would need a different approach like using a specific variant for those configurations or something like that.
v
In a component metadata rule there is no such thing as a "requested attribute", it is not like a disambiguation or compatibility rule that runs in the context of resolution. It is a rule the manipulates the metadata of a component. You probably need to add a new variant based on the existing variant that provides a specific attribute, then manipulate the existing variant to remove the transitive dependencies, then request that new variant where you want to have the transitives.
r
yeah thats roughly what i thought.
thank you
as always 😄
v
You're welcome
r
eww running into some ordering issue. turns out
context.getDetails().addVariant
of a first declared rule is later evaluated than
context.getDetails().allVariants
of a later declared rule. Uff 🫣
v
Hm, I guess optimally they should be written in a way that does not depend on ordering 🤷‍♂️
r
I guess. but tried to have a rule that adds a variant with a specific attribute and then in another rule downstream deal with that attribute. seems like that is a dead end.
I assumed I can organize them like a pipeline 🤷
that would have saved me some boilerplate, but ¯\_(ツ)_/¯
🤷‍♂️ 1