Skip to content
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

Support overriding debuggable in AndroidManifest #13801 #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EdbertChan
Copy link

Background

Similar to bazelbuild/bazel#13801, the only way to get a non debuggable-apk debuggable="false" is to use --compilation-mode opt which will invalidate the entire dep graph.

Changes

The drawback of this diff is that unlike what exists in Bazel upstream, the source of truth for the "debuggable" flag of the AAPT2 command is not what is in the AndroidManifest.xml itself but whatever is in manifest_values in the BUILD file.

If no value, we fallback to the compilation-mode opt behavior.

Usage
android_binary(
name = "app",
dex_shards = 10,
manifest = "src/bazel/AndroidManifest.xml",
manifest_values = {
"minSdkVersion": "19",
"appName": "...",
"applicationId": "...",
"debuggable": "false",
},
multidex = "native",
visibility = ["//visibility:public"],
deps = ["..."],
)

@EdbertChan
Copy link
Author

Per @restingbull (Corbin) offline conversation, the dependency on Compilation.OPT was a matter of convenience from inside of Google. Supposedly, few/nobody who was working on building with the debuggable flag build cared about release so full invalidation was not a problem.

If you weren't building an optimized binary, you should not be building a release anyway since release should be optimized.

Outside of Google, that may not be the case. Some developers very specifically want to work on performance.

@ted-xie
Copy link
Contributor

ted-xie commented Oct 17, 2024

Hey @EdbertChan, now that starlarkification + tools migration are done, I think we have the bandwidth to try out this CL internally. Could you rebase your fork so that the (now-fixed) BazelCI presubmit can run again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants