rules_swift icon indicating copy to clipboard operation
rules_swift copied to clipboard

[Feature Request] Mixed language(C and Swift) swift_library support

Open Kyle-Ye opened this issue 1 year ago • 4 comments

Swift has a SE to make SwiftPM support it. But it is currently "Returned for Revision".

https://github.com/apple/swift-evolution/blob/main/proposals/0403-swiftpm-mixed-language-targets.md

I was wondering whether we have such feature supported on Bazel currently.

Kyle-Ye avatar Mar 25 '24 10:03 Kyle-Ye

You can currently use the experimental_mixed_language_library in rules_apple to support this.

If the SE is ever implemented, or maybe before then, I believe we will move that rule into rules_swift and graduate it to non-experimental.

brentleyjones avatar Mar 25 '24 11:03 brentleyjones

Haven't used experimental_mixed_language_library before. But I'd like to use it in Linux and other platforms too. Does it support such use case?

The repo's name "rules_apple" is hinting me that it will only work for Apple's Darwin platform.

Kyle-Ye avatar Mar 25 '24 12:03 Kyle-Ye

https://github.com/bazelbuild/rules_apple/blob/700f661876678b98596c4e3106396a9029571469/doc/rules-apple.md#experimental_mixed_language_library

Checking the doc, the rule is about ObjectiveC + Swift. But the SE and my issue is about C and Swift not ObjectiveC specific.

Kyle-Ye avatar Mar 25 '24 12:03 Kyle-Ye

The version that gets added to rules_swift would need to support C. For now you can probably write your own macro that uses cc_library instead of objc_library.

brentleyjones avatar Mar 25 '24 15:03 brentleyjones