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

Revert "Add resource collection for cc_* rules" #2475

Merged
Merged
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
10 changes: 1 addition & 9 deletions apple/internal/aspects/resource_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _apple_resource_aspect_impl(target, ctx):
if ctx.rule.attr.srcs or ctx.rule.attr.non_arc_srcs or ctx.rule.attr.deps:
owner = str(ctx.label)

elif ctx.rule.kind in ["cc_import", "objc_import"]:
elif ctx.rule.kind == "objc_import":
collect_args["res_attrs"] = ["data"]

elif ctx.rule.kind == "swift_library":
Expand All @@ -165,14 +165,6 @@ def _apple_resource_aspect_impl(target, ctx):
process_args["bundle_id"] = ctx.rule.attr.bundle_id or None
bundle_name = "{}.bundle".format(ctx.rule.attr.bundle_name or ctx.label.name)

elif ctx.rule.kind == "cc_library":
collect_args["res_attrs"] = ["data"]

# Only set cc_library targets as owners if they have srcs or deps. This
# treats cc_library targets without sources as resource aggregators.
if ctx.rule.attr.srcs or ctx.rule.attr.deps:
owner = str(ctx.label)

# Collect all resource files related to this target.
if collect_infoplists_args:
infoplists = resources.collect(
Expand Down
11 changes: 0 additions & 11 deletions test/starlark_tests/ios_application_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -992,17 +992,6 @@ Found "com.bazel.app.example" which does not match previously defined "com.altba
tags = [name],
)

# Test app with cc_library `data` attribute includes the data files in the final binary.
archive_contents_test(
name = "{}_contains_cc_library_data".format(name),
build_type = "simulator",
target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_cc_library_data",
contains = [
"$BUNDLE_ROOT/basic.bundle",
],
tags = [name],
)

native.test_suite(
name = name,
tags = [name],
Expand Down
48 changes: 0 additions & 48 deletions test/starlark_tests/macos_application_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -397,54 +397,6 @@ def macos_application_test_suite(name):
tags = [name],
)

# Test app with cc_library dependency that defines `data` attribute.
archive_contents_test(
name = "{}_contains_cc_library_data".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_cc_library_data",
contains = [
"$CONTENT_ROOT/MacOS/app_with_cc_library_data",
"$CONTENT_ROOT/Resources/basic.bundle",
],
tags = [name],
)

# Test app with cc_library dependency that defines structured resources.
archive_contents_test(
name = "{}_contains_cc_library_structured_resources".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_cc_library_structured_resources",
contains = [
"$CONTENT_ROOT/MacOS/app_with_cc_library_structured_resources",
"$CONTENT_ROOT/Resources/Resources/some.file",
],
tags = [name],
)

# Test app with cc_import dependency that defines `data` attribute.
archive_contents_test(
name = "{}_contains_cc_import_data".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_cc_import_data",
contains = [
"$CONTENT_ROOT/MacOS/app_with_cc_import_data",
"$CONTENT_ROOT/Resources/basic.bundle",
],
tags = [name],
)

# Test app with cc_import dependency that defines structured resources.
archive_contents_test(
name = "{}_contains_cc_import_structured_resources".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_cc_import_structured_resources",
contains = [
"$CONTENT_ROOT/MacOS/app_with_cc_import_structured_resources",
"$CONTENT_ROOT/Resources/Resources/some.file",
],
tags = [name],
)

native.test_suite(
name = name,
tags = [name],
Expand Down
53 changes: 0 additions & 53 deletions test/starlark_tests/resources/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1117,56 +1117,3 @@ swift_library(
linkopts = ["-Wl,-framework,AppIntents"],
tags = common.fixture_tags,
)

# --------------------------------------------------------------------------------
# C/C++ rules with data

cc_library(
name = "cc_lib_with_data",
srcs = ["main.cc"],
data = [
"//test/testdata/resources:basic_bundle",
],
tags = common.fixture_tags,
)

cc_library(
name = "cc_lib_with_structured_resources",
srcs = ["main.cc"],
data = [
":structured_resources_in_resources",
],
tags = common.fixture_tags,
)

cc_library(
name = "cc_lib_with_cc_import_with_data",
srcs = ["main.cc"],
deps = [
":cc_import_with_data",
],
)

cc_library(
name = "cc_lib_with_cc_import_with_structured_resources",
srcs = ["main.cc"],
deps = [
":cc_import_with_structured_resources",
],
)

cc_import(
name = "cc_import_with_data",
data = [
"//test/testdata/resources:basic_bundle",
],
tags = common.fixture_tags,
)

cc_import(
name = "cc_import_with_structured_resources",
data = [
":structured_resources_in_resources",
],
tags = common.fixture_tags,
)
16 changes: 0 additions & 16 deletions test/starlark_tests/targets_under_test/ios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4957,19 +4957,3 @@ ios_extension(
"//test/starlark_tests/resources:objc_main_lib",
],
)

# ---------------------------------------------------------------------------------------
# Targets to test resource processing with C/C++ rules.

ios_application(
name = "app_with_cc_library_data",
bundle_id = "com.google.example",
families = ["iphone"],
infoplists = [
"//test/starlark_tests/resources:Info.plist",
],
minimum_os_version = common.min_os_ios.baseline,
deps = [
"//test/starlark_tests/resources:cc_lib_with_data",
],
)
55 changes: 0 additions & 55 deletions test/starlark_tests/targets_under_test/macos/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2907,58 +2907,3 @@ macos_unit_test(
"//test/starlark_tests/resources:objc_test_lib",
],
)

# ---------------------------------------------------------------------------------------
# Targets to test resource processing with C/C++ rules.

macos_application(
name = "app_with_cc_library_data",
bundle_id = "com.google.example",
infoplists = [
"//test/starlark_tests/resources:Info.plist",
],
minimum_os_version = common.min_os_macos.baseline,
tags = common.fixture_tags,
deps = [
"//test/starlark_tests/resources:cc_lib_with_data",
],
)

macos_application(
name = "app_with_cc_import_data",
bundle_id = "com.google.example",
infoplists = [
"//test/starlark_tests/resources:Info.plist",
],
minimum_os_version = common.min_os_macos.baseline,
tags = common.fixture_tags,
deps = [
"//test/starlark_tests/resources:cc_lib_with_cc_import_with_data",
],
)

macos_application(
name = "app_with_cc_library_structured_resources",
bundle_id = "com.google.example",
infoplists = [
"//test/starlark_tests/resources:Info.plist",
],
minimum_os_version = common.min_os_macos.baseline,
tags = common.fixture_tags,
deps = [
"//test/starlark_tests/resources:cc_lib_with_structured_resources",
],
)

macos_application(
name = "app_with_cc_import_structured_resources",
bundle_id = "com.google.example",
infoplists = [
"//test/starlark_tests/resources:Info.plist",
],
minimum_os_version = common.min_os_macos.baseline,
tags = common.fixture_tags,
deps = [
"//test/starlark_tests/resources:cc_lib_with_cc_import_with_structured_resources",
],
)