A part of my application is written in Rust which gets compiled into an XCFramework and wrapped into its own SwiftPM package together with some Swift bridge code generated by UniFFI. My project depends on this package as a local package dependency (i.e. dependencies: [.package(path: ...)]
).
I'd prefer to be able to keep the Rust sources in the same repo as my main project. But I don't want to check in the compiled binaries because they're too big. What I'd like instead is to build the Rust package as part of the main build, e.g. using a build tool plugin.
My finding/understanding so far is that that you can use build plugins when building targets only, not generate dependencies. And that the Rust package cannot be included as a target, only a dependency (because it consists of both binaries and Swift code).
Is my understanding correct or is there some way that I should be able to make this work? I know that I can move the Rust project to another repo, publish the binaries somewhere and use it as a regular SwiftPM dependency. But that would be disturbing to development, so I'm looking for another way.
Any advice is highly appreciated.
3 posts - 2 participants