Skip to content

Commit

Permalink
Always process Info.plist files with `apple_precompiled_resource_bu…
Browse files Browse the repository at this point in the history
…ndle` (#2591)

This matches the behavior of `apple_resource_bundle`.

Signed-off-by: Brentley Jones <[email protected]>
  • Loading branch information
brentleyjones authored Nov 11, 2024
1 parent 79cf73d commit 1477ccf
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions apple/internal/resource_rules/apple_precompiled_resource_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,40 @@ def _apple_precompiled_resource_bundle_impl(ctx):
"rule_label": label,
}

if ctx.files.infoplists:
infoplists = resources.collect(
attr = ctx.attr,
res_attrs = ["infoplists"],
)
else:
infoplists = resources.collect(
attr = ctx.attr,
res_attrs = ["_fallback_infoplist"],
)

bucketized_owners, unowned_resources, buckets = resources.bucketize_typed_data(
bucket_type = "infoplists",
owner = owner,
parent_dir_param = bundle_name,
resources = infoplists,
**bucketize_args
)
apple_resource_infos.append(
resources.process_bucketized_data(
bucketized_owners = bucketized_owners,
buckets = buckets,
platform_prerequisites = platform_prerequisites,
processing_owner = owner,
resource_types_to_process = ["infoplists"],
unowned_resources = unowned_resources,
**process_args
),
)

resource_files = resources.collect(
attr = ctx.attr,
res_attrs = ["resources"],
)

if resource_files:
bucketized_owners, unowned_resources, buckets = resources.bucketize_data(
resources = resource_files,
Expand Down Expand Up @@ -183,37 +212,6 @@ def _apple_precompiled_resource_bundle_impl(ctx):
),
)

if ctx.files.infoplists:
infoplists = resources.collect(
attr = ctx.attr,
res_attrs = ["infoplists"],
)
else:
infoplists = resources.collect(
attr = ctx.attr,
res_attrs = ["_fallback_infoplist"],
)

if infoplists and apple_resource_infos:
bucketized_owners, unowned_resources, buckets = resources.bucketize_typed_data(
bucket_type = "infoplists",
owner = owner,
parent_dir_param = bundle_name,
resources = infoplists,
**bucketize_args
)
apple_resource_infos.append(
resources.process_bucketized_data(
bucketized_owners = bucketized_owners,
buckets = buckets,
platform_prerequisites = platform_prerequisites,
processing_owner = owner,
resource_types_to_process = ["infoplists"],
unowned_resources = unowned_resources,
**process_args
),
)

# Get the providers from dependencies
inherited_apple_resource_infos = [
x[AppleResourceInfo]
Expand Down

0 comments on commit 1477ccf

Please sign in to comment.