diff --git a/rules/framework.bzl b/rules/framework.bzl index 78bacd966..b498828b6 100644 --- a/rules/framework.bzl +++ b/rules/framework.bzl @@ -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: @@ -538,6 +548,7 @@ def _copy_swiftmodule(ctx, framework_files): swiftdoc = inputs.swiftdoc, swiftmodule = inputs.swiftmodule, swiftinterface = inputs.swiftinterface, + symbol_graph = symbol_graph, ) return [