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

Fix nesting of bundles with apple_precompiled_resource_bundle #2588

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ load(
"@bazel_skylib//lib:partial.bzl",
"partial",
)
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleFrameworkBundleInfo",
"AppleResourceInfo",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_toolchains.bzl",
"AppleMacToolsToolchainInfo",
Expand Down Expand Up @@ -51,6 +56,10 @@ load(
"@build_bazel_rules_apple//apple/internal:rule_support.bzl",
"rule_support",
)
load(
"@build_bazel_rules_apple//apple/internal/aspects:resource_aspect.bzl",
"apple_resource_aspect",
)
load(
"//apple/internal:apple_product_type.bzl",
"apple_product_type",
Expand Down Expand Up @@ -205,6 +214,27 @@ def _apple_precompiled_resource_bundle_impl(ctx):
),
)

# Get the providers from dependencies
inherited_apple_resource_infos = [
x[AppleResourceInfo]
for x in ctx.attr.resources
if AppleResourceInfo in x and
# Filter Apple framework targets to avoid propagating and bundling
# framework resources to the top-level target (eg. ios_application)
AppleFrameworkBundleInfo not in x
]
if inherited_apple_resource_infos:
# Nest the inherited resource providers within the bundle, if one is
# needed for this rule
merged_inherited_provider = resources.merge_providers(
default_owner = owner,
providers = inherited_apple_resource_infos,
)
apple_resource_infos.append(resources.nest_in_bundle(
provider_to_nest = merged_inherited_provider,
nesting_bundle_dir = bundle_name,
))

providers = [
new_appleresourcebundleinfo(),
]
Expand Down Expand Up @@ -260,6 +290,7 @@ non-RFC1034-compliant characters with -.
"resources": attr.label_list(
allow_empty = True,
allow_files = True,
aspects = [apple_resource_aspect],
doc = """
Files to include in the resource bundle. Files that are processable resources, like .xib,
.storyboard, .strings, .png, and others, will be processed by the Apple bundling rules that have
Expand Down