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 4, 2023
1 parent a17fe64 commit bf55c9f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,25 @@ 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_grap in the direct_modules of the deps of this target
# and add it to the swift info
symbol_graph = None
for dep in ctx.attr.deps[1:]:
if SwiftInfo in dep:
for module in dep[SwiftInfo].direct_modules:
if module.swift and module.swift.symbol_graph:
symbol_graph = module.swift.symbol_graph
break
if 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 +551,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 bf55c9f

Please sign in to comment.