Swift Package Manager already supports building Swift, C, C++ and assembly code.
I've just come up with this crazy idea: what if we allow SPM to build Rust targets?
For now I have the following in mind:
- Obviously, for building Rust targets the rust toolchain has to be installed.
- We don't use Cargo for building Rust targets, but rather invoke rustc directly. We could allow Swift packages to depend on Cargo packages in the future, but that seems nontrivial.
- Rust targets can only depend on other Rust targets. Swift or Clang targets cannot depend on Rust targets. Why? Because it would require a lot of work. Later we could allow Rust targets to have the "include" directory just like Clang targets, which would contain C headers for that target so that the Rust target could be used from Swift using those headers (just like C++ targets today can be used from Swift via C headers).
I've started working on this in my SPM fork, but even basic functionality is yet to be implemented.
However, I wanted to know if this kind of functionality is desired by the community at all, and if yes, would it be accepted by the project maintainers?