Skip to content

Commit

Permalink
Add support for forwarding symbol graph
Browse files Browse the repository at this point in the history
  • Loading branch information
luispadron committed Jul 6, 2023
1 parent a17fe64 commit 5b53204
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,22 @@ def _copy_swiftmodule(ctx, framework_files):
# only add a swift module to the SwiftInfo if we've actually got a swiftmodule
swiftmodule_name = paths.split_extension(inputs.swiftmodule.basename)[0]

# find the first swift symbol_graph in the direct_modules of the deps of this target and forward it.
symbol_graph = None
for dep in ctx.attr.deps:
if SwiftInfo in dep:
module = dep[SwiftInfo].direct_modules[0]
if module.swift and module.swift.symbol_graph:
symbol_graph = module.swift.symbol_graph
break

# need to include the swiftmodule here, even though it will be found through the framework search path,
# since swift_library needs to know that the swiftdoc is an input to the compile action
swift_module = swift_common.create_swift_module(
swiftdoc = outputs.swiftdoc,
swiftmodule = outputs.swiftmodule,
swiftinterface = outputs.swiftinterface,
symbol_graph = symbol_graph,
)

if swiftmodule_name != ctx.attr.framework_name:
Expand All @@ -538,6 +548,7 @@ def _copy_swiftmodule(ctx, framework_files):
swiftdoc = inputs.swiftdoc,
swiftmodule = inputs.swiftmodule,
swiftinterface = inputs.swiftinterface,
symbol_graph = symbol_graph,
)

return [
Expand Down

0 comments on commit 5b53204

Please sign in to comment.