Commit 012ebad
committed
Fix resource merge priority so consumer library overrides dependency resources
The Android resource busybox uses last-wins semantics when merging duplicate
resource names. The current library's ResourcesNodeInfo was placed as the
first direct item of the direct_resources_nodes preorder depset, causing it
to be processed before its dependencies and lose to them on conflicts.
Fix the ordering at the consumption point in busybox.bzl: reverse the
direct_resources_nodes list when building --directData (and --directAssets)
arguments. This ensures the current library's node (first in preorder) ends
up last in the busybox flag, so its resources correctly override those of its
dependencies — matching native Bazel and Gradle behavior.
A regression test was not added because the fix is only observable in
non-legacy manifest_merge_order mode. In legacy mode, _process_starlark
swaps each library's dep nodes out of direct_resources_nodes into
transitive_resources_nodes before building the provider, so every library
exposes only its own node in direct_resources_nodes. Downstream targets
therefore see exactly one node per direct dep in --directData, making the
reversal a no-op. All CI resource tests run exclusively with
--//rules/flags:manifest_merge_order=legacy, so the fix cannot be exercised
through the existing analysis-time test framework without adding a non-legacy
CI configuration or a configuration transition on the test target.1 parent 8936d9e commit 012ebad
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | | - | |
| 318 | + | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
322 | | - | |
| 324 | + | |
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
| |||
532 | 534 | | |
533 | 535 | | |
534 | 536 | | |
| 537 | + | |
| 538 | + | |
535 | 539 | | |
536 | 540 | | |
537 | | - | |
| 541 | + | |
538 | 542 | | |
539 | 543 | | |
540 | 544 | | |
| |||
782 | 786 | | |
783 | 787 | | |
784 | 788 | | |
| 789 | + | |
| 790 | + | |
785 | 791 | | |
786 | 792 | | |
787 | | - | |
| 793 | + | |
788 | 794 | | |
789 | 795 | | |
790 | 796 | | |
| |||
0 commit comments