-
Notifications
You must be signed in to change notification settings - Fork 38
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
Bazel AndroidManifest merging doesn't preserve the correct order #192
Comments
Related: #190 |
To make sure we're talking about the same things, I adapted the basicapp in examples:
And then the merged manifest is:
With "bar" from AndriodManifestBar.xml as expected. If the the names of the libraries are swapped (but not their dependency order, i.e. it's still AndroidManifest.xml -> AndroidManifestBar.xml -> AndroidManifestBaz.xml):
then the merged manifest is:
It contains "baz" from the lower-level android_library. As changed in #190 and #193, this results from the sorting here: rules_android/rules/busybox.bzl Line 787 in 3414610
Are there other cases (besides the naming of the targets) that results in unexpected merging priorities? Interstingly, disabling the sorting and using "dependency order" has actually been available in the native rules since early 2019: but that option was added mostly incidentally in the course of adjusting things for changes related to configuration paths and didn't make it in the Starlark migration of the relevant code. I traced the origin of sorting the manifests to see why we do this -- I found the change in late 2014 (prior to open sourcing bazel) that doesn't give much explanation (I suspect it might have just been overly enthusiastic application of "sorting is deterministic") |
I had considered just making "dependency order" the default for the bazel version of the rules (as #190 does, but adjusting so that internally we keep the sorting behavior) but it occurs to me that this would create a potential incompatibility between the native rules and the starlark rules, which could make migrating from native to starlark more complicated -- so we might need a switch in bazel anyway (as #193 does) |
This should be addressed with f13f245 Note that the default is now to merge manifests in "dependency" order instead of what we're now calling "legacy" order (roughly alphabetical). The previous behavior can be enabled with |
The main difference between Gradle and Bazel manifest merging order is "If you have multiple libraries, their manifest priorities match the order they appear in your Gradle dependencies block." (doc) That means the manifest entries in library modules have higher priority than its dependency, which is not the case in bazel.
The text was updated successfully, but these errors were encountered: