-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
One of the benefits we get from the SwiftBuild build system is that it already supports targets that have mixed Swift and clang language family source files. This is accomplished using a bridging header file that exposes the API to Swift, specifying those headers using the -import-bridging-header option.
I was able to quickly prototype this by removing the check in SwiftPM for mixed language targets and then manually adding in a swiftSetting unsafe flag for the bridging header.
For proper ergonomics we should add in a proper flag for this swiftSetting that would specify the path to the header. We could then use the proper build setting when generating the PIF. That appears to be SWIFT_OBJC_BRIDGING_HEADER. Digging into the swift compiler code I see that -import-bridging-header is an alias to -import-objc-header and both of those options are hidden making this setting even more necessary. Note this will require a Swift Evolution proposal and review.
Question remains what to do if the consumer of the package is using the native build system. We probably need to error out in that case. It's not worth adding mixed language support there since it wasn't really built for that.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version && uname -a
)
No response