Allow root module's override tags to take precedence over the overridees from transitive deps.#1381
Conversation
…es from the transitive deps.
…es instead of original value
|
Should be pushed before #1379 |
|
The CI's failing for kt_jvm_export example, however, it's failing for quite some time now, so I'm assuming it's a non-issue. |
shs96c
left a comment
There was a problem hiding this comment.
Love it, and it's sorely needed. Thank you for putting this together. Just a couple of nits, and then I think this is good to go!
| scope = ["@root_module_can_override//:com_squareup_okhttp3_okhttp"], | ||
| ) | ||
|
|
||
| sh_test( |
There was a problem hiding this comment.
Elsewhere we've used a diff_test to check this kind of thing. There's an example of how to ignore the test when not using bzlmod here It would be nice to continue using the same approach here, if only for consistency in our testing.
There was a problem hiding this comment.
Makes sense.
Will update the tests to use diff_test and only run during bzlmod as suggested for consistency.
| path = "tests/integration/override_targets/module", | ||
| ) | ||
|
|
||
| dev_maven.override( |
There was a problem hiding this comment.
Can the comment please mention the test this is used in?
shs96c
left a comment
There was a problem hiding this comment.
LGTM. Thank you for putting this together!
* master: (39 commits) Fix resolution of Android/AAR artifacts with Gradle resolver (bazel-contrib#1395) fail_if_repin_required is now True by default and minor improvement to failure message (bazel-contrib#1397) Housekeeping before we release 6.8 (bazel-contrib#1384) Add dll, dylib and so types to maven package mappings (bazel-contrib#1392) [bzlmod] Allow suppressing warning about multiple contributing modules. (bazel-contrib#1393) Use the artifact default values when adding them to a struct and add tests for coursier artifacts that have empty versions provided by BOMs and don't inlcude them in outdated (bazel-contrib#1390) Allow package exclusions and inclusions in javadocs (bazel-contrib#1293) Document well-known issues with `bzlmod` (bazel-contrib#1388) Begin documenting the gradle resolver (bazel-contrib#1389) Run gradle regression tests in CI (bazel-contrib#1385) Modify maven_export to allow exporting zip archives (bazel-contrib#1368) Allow root module's override tags to take precedence over the overridees from transitive deps. (bazel-contrib#1381) Ensure root module artifacts and boms take precedence with warnings (bazel-contrib#1373) Update maven-metadata.xml when publishing locally (bazel-contrib#1369) Add support for gradle resolver (bazel-contrib#1357) Prepare for 6.8 release (bazel-contrib#1380) Remove the Windows `kt_jvm_export` example (bazel-contrib#1383) Avoid spurious warnings about poorly formatted artifact coordinates (bazel-contrib#1374) Flip `fail_if_repin_required` to `True` by default (bazel-contrib#1371) Allow the same coordinate to be overridden in different repos (bazel-contrib#1378) ...
#1278 author's bandwidth is limited at the moment; As suggested by the OG author, this PR forks the same and addresses the review comments to get these changes merged.
Occasionally, a
bazel_depcan introduce amaven.overridestag that aliases an artifact to another label. This may not be what the root module desires, and so we should allow the root module's overrides to take precedence over any transitive overrides, but at the caution of the root module owner.Concretely, this is a problem encountered by the Bazel project itself, where a
grpc-javatransitive dep overrides@maven//:com_google_protobuf_protobuf_javaas an alias to@@protobuf+//:protobuf_java, which was not desirable.This PR is validated by a test that contains a root override from okhttp to javapoet, which takes precedence over a dependency's override from okhttp to a poison pill label.