What are the limitations to what can be bundled in a binary target?

I'm currently helping the popular macOS updater Sparkle to transition to SPM via a binary target. For those wanting to learn more about how I first tried compiling from source and the changes it involved, it's a good read about resource management in Swift 5.3.
Sparkle is currently distributed via Cocoapods, more specifically it unpacks a release artifact containing Sparkle.framework, debug symbols and binaries that are required in maintaining one's own project with Sparkle.
It seems that after generating the XCFramework via xcodebuild archive and xcodebuild -create-xcframework, it's entirely possible to bundle almost anything into the XCFramework before zipping it and distributing it via SPM. As another forum thread shows, it's possible to manually copy the dSYM files from the XCArchive to the XCFramework. I've been able to more or less any imaginable file in my XCFramework as well (license, changelog, symbols, etc.), including the aforementioned binaries.
Now here come the questions:

  • Is having other files in an XCFramework officially supported?
  • What limitations are there on the files you can put inside an XCFramework?
  • More generally, how should a repo such as Sparkle bundle such other required files going forward? Within the XCFramework or within the ZIP-file (alongside the XCFramework)?

I hope you'll be able to bring clarity to some of these questions :)

2 Likes

Xcode 12 beta 3 actually added support for dSYMs in XCFrameworks:

  • XCFrameworks can now include .dSYM and .bcsymbolmap debugging symbol files in your library bundle with the -debug-symbols flag. Run the command xcodebuild -create-xcframework -help for additional usage information. (64910707)

Oh, hadn't seen that! BTW, I saw your WWDC session on binary targets for SPM and it was excellent :smiley:
Regarding the third question, I've tested both option (in framework and alongside framework) and both work. However, it would be nice if Xcode were able to show the others files found in the ZIP file under Referenced Binaries. I know from the other referenced forum thread that some authors at least include the CHANGELOG and other files within the XCFramework or alongside it. Personally, it feels wrong to dump random files into a bundle that is supposed to wrap around multiple compiled frameworks, so I would prefer adding the files to the archive containing the XCFramework.

1 Like

Thanks!

I think potentially showing extra files from the ZIP could make sense, would you mind filing a feedback report for that?

1 Like

There you go: FB8213053
Thanking you for being so present on these forums and for being so pro-active in handling bugs and suggestions from devs!

2 Likes