Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge clang/swift modules into one
direct_module
in SwiftInfo for a…
… framework (#916) ### What changed: Rework of `_get_merged_swift_info` by bubble up the creation of clang module to `_apple_framework_packaging_impl` level, where it determine how to populate the clang module based on VFS feature on/off. Remove the need to pass `virtualize_frameworks` flag to the private method `_get_merged_swift_info` ### Why this change add `fail(swift_info.direct_modules)` after creation of it at the end of the packging impl method when running `bazel build //tests/ios/frameworks/testonly/... --config=ios --config=vfs`, you get ``` [ struct( clang = struct(compilation_context = <unknown object com.google.devtools.build.lib.rules.cpp.CcCompilationContext>, module_map = None, precompiled_module = None), compilation_context = None, is_system = False, name = "SwiftLibrary", swift = None), struct( clang = None, compilation_context = None, is_system = False, name = "SwiftLibrary", swift = struct(ast_files = (), defines = (), indexstore = None, plugins = [], private_swiftinterface = None, swiftdoc = <generated file tests/ios/frameworks/testonly/SwiftLibrary.swiftdoc>, swiftinterface = None, swiftmodule = <generated file tests/ios/frameworks/testonly/SwiftLibrary.swiftmodule>, swiftsourceinfo = None, symbol_graph = None)) ] ``` with the current impl in `master` branch. Note that for the same module `SwiftLibrary`, there are two structs representing it, one has clang and no swift, and one has swift and nothing inside `clang`. So this PR effectively merge two, but the clang module generation differ based on VFS turn on or not: with VFS on: ``` [struct( clang = struct(compilation_context = <unknown object com.google.devtools.build.lib.rules.cpp.CcCompilationContext>, module_map = None, precompiled_module = None), compilation_context = None, is_system = False, name = "SwiftLibrary", swift = None), struct(clang = None, compilation_context = None, is_system = False, name = "SwiftLibrary", swift = struct(ast_files = (), defines = (), indexstore = None, plugins = [], private_swiftinterface = None, swiftdoc = <generated file tests/ios/frameworks/testonly/SwiftLibrary.swiftdoc>, swiftinterface = None, swiftmodule = <generated file tests/ios/frameworks/testonly/SwiftLibrary.swiftmodule>, swiftsourceinfo = None, symbol_graph = None)) ] ``` with VFS off: ``` [struct( clang = struct(compilation_context = <unknown object com.google.devtools.build.lib.rules.cpp.CcCompilationContext>, module_map = <generated file tests/ios/frameworks/testonly/SwiftLibrary/SwiftLibrary.framework/Modules/module.modulemap>, precompiled_module = None), compilation_context = None, is_system = False, name = "SwiftLibrary", swift = struct(ast_files = (), defines = (), indexstore = None, plugins = [], private_swiftinterface = None, swiftdoc = <generated file tests/ios/frameworks/testonly/SwiftLibrary/SwiftLibrary.framework/Modules/SwiftLibrary.swiftmodule/arm64.swiftdoc>, swiftinterface = None, swiftmodule = <generated file tests/ios/frameworks/testonly/SwiftLibrary/SwiftLibrary.framework/Modules/SwiftLibrary.swiftmodule/arm64.swiftmodule>, swiftsourceinfo = None, symbol_graph = None)) ] ``` This way we now have one direct_module instead of two representing the same `SwiftLIbrary` module. This is important when trying to collect providers for `docc_archive` rule on rules_apple side as otherwise we face `in dep attribute of docc_archive rule <some_target_docc>: '<some_target>' does not have mandatory providers: 'DocCBundleInfo' or 'DocCSymbolGraphsInfo'.` error. ### Tests done 1. tested with downstream big repo's full CI job (which has VFS on + bazel version 7.2.0) 2. CI job itself being green
- Loading branch information