Hello! I have a plugin that performs some modifica...
# community-support
s
Hello! I have a plugin that performs some modifications of attributes associated with resolvable configurations as part of an
afterEvaluate
step in order to aid in variant selection. For the most part this works fine. However, there are some projects where the usage of the plugin result in a failure in the configuration phase indicating that a dependency configuration's attribute can't be modified after it has been resolved. From what I understand resolving a dependency configuration as part of the configuration phase is considered a no-no (perhaps I'm wrong here). Questions: • Is there a straightforward way to determine what is causing a configuration to be resolved? • Is there some alternate way I should go about adding attributes to configurations that isn't susceptible to this sort of failure mode? • Anything else I should be thinking about? Thanks for any help/insight.
p
Yes, as the error message says, you should not change the configurations using afterEvaluate. Instead, try to use the lazy APIs instead. What exactly do you want to configure?
If you want to download files depending on attributes, it’s better to create your own configuration instead of
s
Yeah.. the problem isn't so much my own configurations.. It's getting some of the built in configurations (e.g. implementation) to select an appropriate variant produced by other projects.
The other wrinkle is that I want build script dependent configurations (e.g. when a source set is created) to also similarly be tagged as well as descendants, and (i.i.r.c) the lazy APIs perform configuration before the build script configuration.
I did manage to find the source of the config-time resolution (bad practice) using
--scan
... it was super helpful and pointed at the specific plugin causing the issue.