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

Allow to collect resources from objc_library implementation_deps #1970

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions apple/internal/aspects/resource_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ def _apple_resource_aspect_impl(target, ctx):
),
)

# Get the providers from dependencies, referenced by deps and locations for resources.
# Get the providers from dependencies, referenced by deps, impl_deps and locations for resources.
inherited_providers = []
provider_deps = ["deps"] + collect_args.get("res_attrs", [])
provider_deps = ["deps"] + ["implementation_deps"] + collect_args.get("res_attrs", [])
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to not simplify this list addition?

Suggested change
provider_deps = ["deps"] + ["implementation_deps"] + collect_args.get("res_attrs", [])
provider_deps = ["deps", "implementation_deps"] + collect_args.get("res_attrs", [])

for attr in provider_deps:
if hasattr(ctx.rule.attr, attr):
inherited_providers.extend([
Expand Down Expand Up @@ -292,7 +292,7 @@ def _apple_resource_aspect_impl(target, ctx):

apple_resource_aspect = aspect(
implementation = _apple_resource_aspect_impl,
attr_aspects = ["data", "deps", "resources", "structured_resources"],
attr_aspects = ["data", "deps", "implementation_deps", "resources", "structured_resources"],
attrs = dicts.add(
apple_support.action_required_attrs(),
apple_toolchain_utils.shared_attrs(),
Expand Down
36 changes: 36 additions & 0 deletions test/ios_application_resources_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,42 @@ EOF
assert_equals "2" "$atlasc_count"
}

function test_implementation_deps_resourcess() {
create_common_files
cat >> app/BUILD <<EOF
objc_library(
name = "shared_lib",
data = [
"shared_res/foo.txt",
],
)
objc_library(
name = "app_lib",
implementation_deps = [
":lib",
":shared_lib",
],
)
ios_application(
name = "app",
bundle_id = "my.bundle.id",
families = ["iphone"],
infoplists = ["Info.plist"],
minimum_os_version = "${MIN_OS_IOS}",
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_ios.mobileprovision",
deps = [":app_lib"],
)
EOF

mkdir -p app/shared_res
echo shared_res > app/shared_res/foo.txt

do_build ios //app:app || fail "Should build"
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit]

Suggested change
do_build ios //app:app || fail "Should build"
do_build ios //app:app || fail "Should build"


assert_zip_contains "test-bin/app/app.ipa" \
"Payload/app.app/foo.txt"
}

# Verify that the warning about 76x76 icons doesn't get displayed.
function test_actool_hides_warning_about_76x76_icons() {
create_common_files
Expand Down