developmentOnly and testAndDevelopmentOnly configurations do not specify any attributes causing resolution problems - #51493
Conversation
820e2f8 to
6a432fc
Compare
| * @param from configuration from which to copy attributes | ||
| * @param to configuration to which attributes will be copied | ||
| */ | ||
| @SuppressWarnings({ "rawtypes", "unchecked", "NullAway" }) |
There was a problem hiding this comment.
NullAway warnings should not be suppressed
There was a problem hiding this comment.
in this case, the key is already verified to be present, so it is null safe code, but nullaway is not able to tell. I am not sure how else to handle this situation
There was a problem hiding this comment.
in my latest refactor, it is clear that only the legacy implementation requires this supression, if that helps
33584ad to
6e20db6
Compare
|
Thanks for the review! I have updated this PR with the feedback. |
908d338 to
a9d7ba5
Compare
…y and testAndDevelopmentOnly fixes spring-projectsgh-51492 include refactors in the modified code to better comply with Gradle lazy APIs Signed-off-by: John Burns <wakingrufus@gmail.com>
a9d7ba5 to
4e024fb
Compare
wilkinsona
left a comment
There was a problem hiding this comment.
Thanks for the updates. The change is still a little too broad as it tackles three separate things:
- Copying attributes onto the
developmentOnlyandtestDevelopmentOnlyconfigurations - Introducing some laziness when working with configurations (using
namedinstead ofgetByName - Marking some configurations as not being consumable
There are also some places where a method has changed from private to static that appear unnecessary.
I'd like this PR to focus solely on 1. 2 and 3 are changes that should probably be made but they need to be considered and applied separately. They may also be broader in scope than tackled here as, for example, there are several other places where we call ConfigurationContainer.getByName(String) that may also be candidates for being lazy.
copy configuration attributes from runtimeClasspath to developmentOnly and testAndDevelopmentOnly
fixes gh-51492
the developmentOnly and testAndDevelopmentOnly do not specify attributes, which can lead to Gradle selecting the wrong variant, or failing to resolve due to an ambiguity error. This can be avoided by following best practices regarding configuration attributes in gradle:
https://docs.gradle.org/current/userguide/best_practices_dependencies.html#use_attributes_on_configurations
the productionRuntimeClasspath was previously fixed in b01235e so a similar fix is needed for these configurations as well
I also included refactors in the modified code to better comply with Gradle lazy APIs