Propagate clang module in SwiftInfo for objc-only frameworks #939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR: the
SwiftInfo
provider returned by theapple_framework_packaging
rule should define aclang_module
for the framework (even if the framework only contains objective-C code).Background
When attempting to upgrade our repo from
rules_swift
1.18.0 to 2.3.1, building someswift_library
targets that depend on anios_framework_packaging
target was failing:Using
aquery
and comparing rules_swift 1.18.0 to 2.3.1, I discovered that the modulemap and headers for the framework were previously added to the swift compilation actions via theCcInfo
provider'scompilation_context.headers
field: https://github.com/bazelbuild/rules_swift/blob/1.18.0/swift/internal/compiling.bzl#L1547-L1568In
rules_swift
2.x+, that codepath has changed: theCcInfo
is only used for explicit clang module builds, and the headers and modulemap from targets we depend on are instead gathered from the module field of the SwiftInfo provider for each dependency.For an
objc_library
, the "module" would normally be created by the swift_clang_module_aspect. But that aspect doesn't know about ourapple_framework_packaging
rule, and we already expose aSwiftInfo
provider, so we should add the clang module to it.