This ticket might end up being an epic, but let's start here. MongoMobile is currently only tested using cocoapods' linting, which is less than ideal. I've added a test spec to cocoapods so the tests are at least run, but it would be far more convenient for future development for us to get this all working with SwiftPM. I spent a few hours yesterday trying to do this, and I think SwiftPM isn't quite up to the task yet. Here's what I tried:
- installed mongo_embedded locally to my system, and added a pkg-config file
- used the following updated Package.swift:
This results in being able to compile MongoMobile without any code modifications, however we are unable to actually link properly when running the tests. This is because there is no current way to add an rpath to the resulting test binary automatically, and the frameworks linked to by embedded depend on being able to find the dynamic libraries based on rpath.
I think we'll have a much better shot at getting this working once this proposal is implemented. It's already been accepted, so I imagine this comes out relatively soon.