Skip to content

Commit

Permalink
buck2 for voltron language packs - 2
Browse files Browse the repository at this point in the history
Summary:
Same like D51217538

Fix S378631,
It use buck2 build m4a build like [automation_messenger_for_perftest_playstoretest](D27298583) from v434, and the voltron language pack only contains 75k, see here https://www.internalfb.com/intern/mobile/buildinfo/buildinfo/?build=534694874 , I found out it is caused by buck2 it didn't build correct number of voltron string resources.

The repro way is to build following command
```
buck2 build --show-output fbsource//fbandroid/apps/messenger:messenger_staticdi_dlstr_arm64_filtered_str_debug#generate_voltron_string_resources
```
And the output only contains 10+ folders, if we check the path folder in `resource_dirs_for_voltron_string_source_map`, we will find out the it used filtered_res, which is for non-voltron language packs.

I checked the code and find out the fix can be just provide the correct folder, since the voltron folder was already there, but never correctly being used.

Reviewed By: luluonet

Differential Revision: D51228314

fbshipit-source-id: 3e65f1bca43bb21374c9dea954027ac5207d315c
  • Loading branch information
Yujie-Liu-1 authored and facebook-github-bot committed Nov 12, 2023
1 parent 8a39584 commit d111627
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion prelude/android/android_binary_resources_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def _maybe_filter_resources(
manifest_file = resource.manifest_file,
r_dot_java_package = resource.r_dot_java_package,
res = filtered_res,
voltron_res = voltron_res_info_to_out_res_dir[resource] if is_voltron_language_pack_enabled else None,
text_symbols = resource.text_symbols,
)
filtered_resource_infos.append(filtered_resource)
Expand Down Expand Up @@ -356,7 +357,11 @@ def _maybe_generate_string_source_map(
return None

prefix = "voltron_" if is_voltron_string_source_map else ""
res_dirs = [resource_info.res for resource_info in resource_infos]
res_dirs = []
if is_voltron_string_source_map:
res_dirs = [resource_info.voltron_res for resource_info in resource_infos if resource_info.voltron_res != None]
if len(res_dirs) == 0:
res_dirs = [resource_info.res for resource_info in resource_infos]
output = actions.declare_output("{}string_source_map".format(prefix), dir = True)
res_dirs_file = actions.write("resource_dirs_for_{}string_source_map".format(prefix), res_dirs)
generate_string_source_map_cmd = cmd_args([
Expand Down
2 changes: 2 additions & 0 deletions prelude/android/android_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ AndroidResourceInfo = provider(
"r_dot_java_package": provider_field(typing.Any, default = None), # Artifact | None
# resources defined by this rule. May be empty
"res": provider_field(typing.Any, default = None), # Artifact | None
# voltron resources defined by this rule. May be empty
"voltron_res": provider_field(typing.Any, default = None), # Artifact | None
# priority of the resources, may be 'low' or 'normal'
"res_priority": provider_field(typing.Any, default = None), # str
# symbols defined by the resources, if resources are present
Expand Down

0 comments on commit d111627

Please sign in to comment.