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

Write R8 proguard mappings to a file #130

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

Conversation

Bencodes
Copy link
Contributor

@Bencodes Bencodes commented Sep 8, 2023

Support writing R8 pg mappings out to a file.

@@ -104,6 +106,7 @@ def process_r8(ctx, jvm_ctx, packaged_resources_ctx, build_info_ctx, **_unused_c
name = "r8_ctx",
value = struct(
final_classes_dex_zip = dexes_zip,
proguard_mappings_file = proguard_mappings_file,
Copy link
Contributor Author

@Bencodes Bencodes Sep 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be bundled up into the AAB later either directly or by reading this file from ProguardMappingInfo.

if ProguardMappingInfo in ctx.attr.base_module:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's also the matter of hooking this into native android_binary's proguard map implicit output, which was just recently done for the "discrete" style dex/desugar/optimize pipeline: bazelbuild/bazel@3faa686

@@ -104,6 +106,7 @@ def process_r8(ctx, jvm_ctx, packaged_resources_ctx, build_info_ctx, **_unused_c
name = "r8_ctx",
value = struct(
final_classes_dex_zip = dexes_zip,
proguard_mappings_file = proguard_mappings_file,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's also the matter of hooking this into native android_binary's proguard map implicit output, which was just recently done for the "discrete" style dex/desugar/optimize pipeline: bazelbuild/bazel@3faa686

@@ -73,9 +73,11 @@ def process_r8(ctx, jvm_ctx, packaged_resources_ctx, build_info_ctx, **_unused_c

android_jar = get_android_sdk(ctx).android_jar
proguard_specs = proguard.get_proguard_specs(ctx, packaged_resources_ctx.resource_proguard_config)
proguard_mappings_file = ctx.actions.declare_file(ctx.label.name + "_proguard.map")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Native android_binary generates the mapping file only if proguard_generate_mapping is enabled: https://bazel.build/reference/be/android#android_binary.proguard_generate_mapping

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