rules_swift
rules_swift copied to clipboard
State of feature `swift.use_c_modules`
We're looking into using explicit clang modules, but it looks like right now the swift stdlib isn't accessible when the feature is enabled.
I saw https://github.com/bazelbuild/rules_swift/pull/856 had gone in recently, so wanted to see if there was any plan for this in the near-term, or if the necessary toolchain modifications already exist and just didn't make it over to github.
Current state
Building an extremely simple hello world swift_binary with --features swift.use_c_modules results in
<unknown>:0: error: missing required module 'SwiftShims'
Happy to help build this out, but wanted to check and see if the work had already been started/done. 😃
I believe this set of features is being used inside google, but not currently publicly. The biggest missing piece I know of currently is to generate the definitions for the system modules, at Lyft we started working on that a while ago but tabled it so we don't have anything to share there yet either. I think if you had those definitions and dependencies setup correctly the rules would work with them.
OK, I'm looking at just adding a swift_c_module (with some tweaks) for SwiftShims since that seems to fix the "Hello world" case at least. Possibly a little tricky since the shims module is defined per-platform (i.e. /Applications/Xcode_13.4.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/swift/shims but shouldn't be too hard to work with.
Yea I think for the productionized version of this it would make sense to generate the BUILD file for the system frameworks as a repository rule