-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurations will not be able to change roles in 9.0 #718
Comments
We copy the configurations so that we can rewrite the dependencies to use dynamic versions. We then resolve the original and our modified version, compare the versions selected, and report on this difference. Originally this was a detached configuration, but there were too many Gradle bugs (like repository handler's deduplication logic either adding multiple or dropping repositories), so copying was the safest option. It also meant that we could honor configuration that was not always exposed, like resolution strategies. Those flag changes were done in a best-effort fashion, as we swallow the exception if not resolvable. They did not exist when the plugin was written (Gradle 1.x) and were quirky (broken) in their first release, so had to be added for functionality. I believe that could be removed by changing to the newer resolution approach in v4 onward, e.g. see the dependency-analyze plugin's logic. This plugin is mostly being casually maintained by contributors who graciously offer their time. It is ten years old, for what was meant to be a stop-gap that the Gradle team would fill when they had time (and often they said as much, but deferred that work due to this plugin being available). If you would like to see major improvements then PRs are very welcome (or advocate for a native feature that replaces this plugin). Otherwise it is whenever someone in the community kindly offers their energy, so we can't specify a timeline on when this might be fixed. |
Thank you for all the context here. Plans to deprecate/remove As for not being able to change configuration roles -- that will certainly no longer be allowed in 9.0. I've prepared a PR which resolves the roles issue while leaving the copying behavior intact: #721 |
Fixes: #718 Updates plugin to only resolve resolvable configurations. As a result, configurations like implementation are not resolved individually, but transitively via any resolvable configurations which extend it. To handle this change, Resolver.kt was updated throughout to use allDependencies and allDependencyConstraints in order to ensure the resolved/unresolved dependency comparisons with the latest versions include inherited dependencies from non-resolvable configurations which were previously being resolved individually.
In Gradle 9.0, configurations will no longer be able to change roles. However, the following code changes the
isCanBeResolved
flag of a copied configuration:gradle-versions-plugin/gradle-versions-plugin/src/main/kotlin/com/github/benmanes/gradle/versions/updates/Resolver.kt
Lines 108 to 109 in 0e5660e
Further, starting in 8.0, these copied configuration will carry the same deprecation warnings that the source configurations had. This means in 8.0, this plugin will start printing deprecation warnings when attempting to add dependencies to and resolve arbitrary copied configurations.
Finally, there are tentative plans to remove configuration copying in 9.0.
Is the copying here strictly necessary? Are there alternative approaches which can be used to avoid copying configurations and changing their flags?
The text was updated successfully, but these errors were encountered: