Skip to content

Commit

Permalink
Add proper support for rules_swift mixed_language_library (#2580)
Browse files Browse the repository at this point in the history
This reverts commit 942c213 and
a30f53e.

Instead, in rules_swift, the `mixed_language_library` macro sets `data`
on the exposed target. We then adjust the resource aspect to look at
that attribute.

Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
brentleyjones authored Oct 31, 2024
1 parent a30f53e commit 0c9739b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apple/internal/aspects/resource_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ def _apple_resource_aspect_impl(target, ctx):
collect_args["res_attrs"] = ["data"]
owner = str(ctx.label)

elif ctx.rule.kind == "mixed_language_library":
default_action = apple_resource_hint_action.resources
module_names = [x.name for x in target[SwiftInfo].direct_modules if x.swift]
bucketize_args["swift_module"] = module_names[0] if module_names else None
collect_args["res_attrs"] = ["data"]
owner = str(ctx.label)

elif ctx.rule.kind in ["apple_static_framework_import", "apple_static_xcframework_import"]:
default_action = apple_resource_hint_action.resources
if AppleFrameworkImportBundleInfo in target:
Expand Down Expand Up @@ -430,9 +437,6 @@ apple_resource_aspect = aspect(
"private_deps",
"structured_resources",
"resources",
# rules_swift `mixed_language_target`
"clang_target",
"swift_target",
],
attrs = dicts.add(
apple_support.action_required_attrs(),
Expand Down

0 comments on commit 0c9739b

Please sign in to comment.