Allowing plugins to generate mixed-language sources

With the SE-0541 PR merged, is there anything that would speak against allowing plugins to generate C files into Swift targets when experimentalCGen is enabled? I put an agent to the task and for my rather simple use case (C file that calls functions declared in Swift, but is not referenced from Swift source), it was enough to remove the checks in SwiftModuleBuildDescription.swift and TargetSourcesBuilder.swift to make it work.

For context, I have a PoC for Swift-PHP interop that I would like to explore further, but to declare function and class descriptions for the PHP runtime, it currently generates Swift code that mimics what the official C macros expand to, which is rather ugly, and unstable across PHP versions as well.

1 Like

Generating C files should be fairly trivial at this point. Generating headers via plugin likely needs a bit of design work around whether they should be treated as public vs project headers, or whether plugins should have API to make that determination. And also how they interact with handwritten vs generated module maps.