The short answer of the use case is to break up a very large app (at Amazon) and not have to compile the entire thing from source.
We have already been doing this by using the old Xcode project generator (although I’ve made modifications to it). With that we can create XCFrameworks. In my modifications to the Xcode project generator, I actually implemented support for resources and binary artifacts, modeling after the Swift Evolution documents. We’ve taken advantage of the SPM mirroring feature to mirror our own urls with mirrored packages that point to the binary XCFrameworks that we have built (mirroring source code with prebuilt binary).
This has obviously required a lot of customization on our part, and I was hoping to do away with that, but it looks like I still need to keep waiting, especially since the new resources and binary artifact support was only implemented via Xcode integration, and not via the old Xcode project generator tool.
I scheduled a session tomorrow, so hopefully I can go over more specifics then. I know I’m not going to get everything I want this year, but I’m glad to see all the progress that continues to be made on SPM.
Post
Replies
Boosts
Views
Activity
Here is essentially the strategy:
Say we have 2 packages:
http://example.com/PackageA
http://example.com/PackageB
We have a CI tool that builds PackageB and saves PackageB.xcframework somewhere: http://example.com/prebuilt/PackageB
The prebuilt PackageB has its own Package.swift, with a binary target instead of a source target: .binaryTarget(“PackageB”, url: “http://example.com/prebuilt/PackageB”)
So then for PackageA, we can
swift package set-mirror —package-url “http://example.com/PackageB” —mirror-url “http://example.com/prebuilt/PackageB”
Then voila, PackageA now has a precompiled PackageB artifact instead of building it from source.
We are already doing this, because of my own modifications to pbxproj().swift in SPM, but I’m hoping to get rid of that.
Yes, I was aware of that proposal, but I was hoping I could make XCFrameworks from my packages and not have to wait for the full implementation of that proposal. But I guess that not the case. I will continue to wait patiently. Thank you for the quick responses.