Skip to content

Commit cc6af56

Browse files
Add implicit deps to swift_library_group (#1468)
Without this, we won’t add required linkopts to `apple_xcframework_import` targets. Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent 9bba637 commit cc6af56

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

swift/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ bzl_library(
217217
":providers",
218218
":swift_clang_module_aspect",
219219
"//swift/internal:attrs",
220+
"//swift/internal:toolchain_utils",
220221
"//swift/internal:utils",
221222
],
222223
)

swift/swift_library_group.bzl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,33 @@
1515
"""Implementation of the `swift_library_group` rule."""
1616

1717
load("//swift/internal:attrs.bzl", "swift_deps_attr")
18+
load(
19+
"//swift/internal:toolchain_utils.bzl",
20+
"get_swift_toolchain",
21+
"use_swift_toolchain",
22+
)
1823
load("//swift/internal:utils.bzl", "get_providers")
1924
load(":providers.bzl", "SwiftInfo")
2025
load(":swift_clang_module_aspect.bzl", "swift_clang_module_aspect")
2126

2227
def _swift_library_group_impl(ctx):
28+
swift_toolchain = get_swift_toolchain(ctx)
29+
2330
deps = ctx.attr.deps
2431

2532
return [
2633
DefaultInfo(),
2734
cc_common.merge_cc_infos(
28-
cc_infos = [dep[CcInfo] for dep in deps if CcInfo in dep],
35+
cc_infos = ([dep[CcInfo] for dep in deps if CcInfo in dep] +
36+
swift_toolchain.implicit_deps_providers.cc_infos),
2937
),
3038
coverage_common.instrumented_files_info(
3139
ctx,
3240
dependency_attributes = ["deps"],
3341
),
3442
SwiftInfo(
35-
swift_infos = get_providers(deps, SwiftInfo),
43+
swift_infos = (get_providers(deps, SwiftInfo) +
44+
swift_toolchain.implicit_deps_providers.swift_infos),
3645
),
3746
# Propagate an `apple_common.Objc` provider with linking info about the
3847
# library so that linking with Apple Starlark APIs/rules works
@@ -60,4 +69,5 @@ A new module isn't created for this target, you need to import the grouped
6069
libraries directly.
6170
""",
6271
implementation = _swift_library_group_impl,
72+
toolchains = use_swift_toolchain(),
6373
)

0 commit comments

Comments
 (0)