SwiftPM making `@_exported import` visible to objc clients

Hello SwiftPM community :wave:

I have a specific use case which I want to achieve, but I lack the linking knowledge to figure this out on my own. I have a framework A, which relies on framework B under the hood. Important primitives used in the framework A are actually defined in framework B, and I want to allow the users of my framework to just write import A and have everything they need from framework B.

In Swift I achieved this by using @_exported import and it works like a charm. The problem is that my framework is also compatible with objc. When using the framework from objc I have to write both @import A and @import B which I would like to avoid because it's source-breaking.

By using Cocoapods I was able to do this by creating a custom A.modulemap and A-umbrella.h file that includes B-umbrella.h and then B primitives are visible just from @import A.

With SPM I tried using unsafe flags in swift settings

swiftSettings: [
    .unsafeFlags(["-Xcc", "-fmodule-map-file=A.modulemap"])
]

But this didn't work. During the build steps there are steps called Write A.modulemap and Copy A.modulemap and when I inspect the file being copied and written to it's the auto-generated one and not the one I provided.

Is something like this possible with SPM? Should I even do it like this, I feel like I'm hacking this a bit too much and the unsafe part of unsafe flags is not giving me much confidence I'm doing things properly :sweat_smile: