google / volley

https://google.github.io/volley
Apache License 2.0
3.37k stars 751 forks source link

Fix listing of dependencies in Volley POM files. #423

Closed jpd236 closed 3 years ago

jpd236 commented 3 years ago

We were depending directly on the .aar, which loses the dependency information from the build configuration itself.

This caused android.annotations to (correctly) show up as a dependency. Since it is only needed for annotations (like @Nullable) that don't need to be retained at runtime, we can mark this as a compileOnly dependency, matching its former "provided" state, to prevent Volley users from needing it. However, this introduces a compiler warning in the tests, since @RestrictTo has RetentionPolicy.CLASS and is not present at compile time; since we apply -Werror to all compile tasks, this becomes a compiler error. For now, to keep the build as close as possible to the prior state, add the annotations as an implementation dependency to the tests; a proper fix is tracked in #424.

The only resulting change to the POM files is that volley-cronet declares a dependency on volley.

Note that volley-cronet doesn't declare a dependency on Cronet because there are two plausible choices for how to use Cronet - the version in GmsCore, or the standalone version. There's no great way to codify this dependency choice, so leave it unstated.

Fixes #402

jpd236 commented 3 years ago

FYI - I had to make a small change to get this to build; by changing the annotation dependency from implementation to compileOnly, the tests broke because of a compiler warning due to a missing annotation referenced in the library class files, and since -Werror is on.

For the library itself, this behavior seems to match that of version 1.2.0, where the POM files didn't declare the dependency either, so rather than try to fix it now, I've filed #424 to invest a longer-term solution and worked around it by declaring the annotations as a test-time dependency as well.