dropbox / dependency-guard

A Gradle plugin that guards against unintentional dependency changes.
Apache License 2.0
417 stars 15 forks source link

Use domain object container to avoid afterEvaluate. #9

Closed autonomousapps closed 2 years ago

autonomousapps commented 2 years ago

This draft PR is based on the test PR I made earlier (so you can ignore the first commit). I'm sharing this in its draft state to get your feedback on the general idea. In the end, the ultimate idea would be to remove the mutable list entirely from the extension.

One thing worth noting is that there's a subtle bug in the current implementation of the plugin. You use this function in your task configuration:

requirePluginConfig(target, extension)

That will fail if extension.configurations is empty. You are implicitly assuming that the dependencyGuard DSL block will be evaluated before tasks get configured. I can imagine a scenario that triggers task configuration early, causing a failure even though the build script is correctly configured. It would be a complex scenario, but people do crazy things in their builds and plugins. I think you'd be better off delaying that check to task execution.

autonomousapps commented 2 years ago

It's failing the API check again (which is expected).