Skip to content

Commit

Permalink
Add package_resources option to android_aar
Browse files Browse the repository at this point in the history
Summary: Adds a `package_resources` option to `android_aar` buck rule, that when disabled doesn't include resources (`res/` and `R.txt`) to the AAR.

Reviewed By: TheWisp

Differential Revision: D60514572

fbshipit-source-id: 20c1a2045bd0976b0c0def44ffa2d4883b53e479
  • Loading branch information
helfper authored and facebook-github-bot committed Aug 2, 2024
1 parent 6b36c3e commit 341c8cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions android/android.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ extra_attributes = {
"native_library_merge_glue": attrs.option(attrs.split_transition_dep(cfg = cpu_split_transition), default = None),
"native_library_merge_linker_args": attrs.option(attrs.dict(key = attrs.string(), value = attrs.list(attrs.arg())), default = None),
"package_asset_libraries": attrs.bool(default = True),
"package_resources": attrs.bool(default = True),
"resources_root": attrs.option(attrs.string(), default = None),
"strip_libraries": attrs.default_only(attrs.bool(default = not DISABLE_STRIPPING)),
"_android_toolchain": toolchains_common.android(),
Expand Down
2 changes: 1 addition & 1 deletion android/android_aar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def android_aar_impl(ctx: AnalysisContext) -> list[Provider]:
android_toolchain = ctx.attrs._android_toolchain[AndroidToolchainInfo]
if resource_infos:
res_dirs = [resource_info.res for resource_info in resource_infos if resource_info.res]
if res_dirs:
if ctx.attrs.package_resources and res_dirs:
merged_resource_sources_dir = ctx.actions.declare_output("merged_resource_sources_dir/res", dir = True)
merge_resource_sources_cmd = cmd_args([
android_toolchain.merge_android_resource_sources[RunInfo],
Expand Down

0 comments on commit 341c8cb

Please sign in to comment.