Has Something Changed With Framework Packaging?

First things first. I understand all the foibles with distribution challenges with the distribution of Swift-including Frameworks! I'm just puzzled by a recent change of behaviour that we are seeing with building things.


With that out of the way, something seems to have changed with Framework packaging.


The Setup:

We have a mixed language Framework that is mostly Swift, but has some Obj-C mixed in. In order to not expose all of the nasty guts, we have a secondary module map that only exists inside the project so that the Swift classes can access the C stuff inside the Framework. (You can see said framework here. And yes I know, I know… I've only recently taken over the project and I'm going to clean it up!)


While working on our current project I've been simply using a workspace that has both the Framework and our main Bundle projects in it. They both build when needed and everything is fine.


The Issue:

I wanted to make this simpler to build, without resorting to a package manager, so that it can easily be built by community members or a CI system. The easiest route seemed to be to just checkin a copy of the framework to the main project. That though has not been true. This has turned into a challenge though as unless you build the projects on the same Mac, clang will start spouting off about the Framework-internal module being missing.


This is all a bit strange as my dev partner swears up and down it used to work when just sending the framework around. I'm not totaly convinced he's not nuts, but the way the issue presents itself is puzzling.


If I simply build the framework and the main project on the same Mac everything works. I don't need to build them at the same time. I don't need to build them with any particular style or options. I don't need to keep the build artifacts in DerivedData around. Build on the same Mac and everything it good.


If I build the framework and then copy it to another Mac it won't work when I build the main project. The machines have identical macOS and development packages on them. Nothing 3rd party, just macOS High Sierra and Xcode from the production MAS.


The Attempts to Fix It:

I've tried any number of things:

  • Custom module maps (This confuses Xcode.)
  • Submodules rather than private ones. (This made Xcode angry!)
  • Private module maps (The Clang docs seem out of date. It infuriates Xcode if you try to make a top level modulemap private.)
  • Including the .h files in the umbrella header. (The Swift/Objective-C docs seem out of date. Xcode found a puppy, kicked it, then complained about non-modular headers in a modular framework even if I changed the setting to allow it to yes.)
  • Crazy incantations from Stack Overflow and the web at large. (They all seem out of date. Xcode doesn't read SO, it's "above" that. Or so it says.)


My Grim Resigniation to the Truth:

All this made me realize a few things:

  1. I was right the whole time about always building.
  2. This makes it hard to use most CI solutions with custom frameworks.
  3. My buisness partner is out of his mind.
  4. The documentation on even attempting this is scant and out of date when you find it.


At this point I'm looking into Carthage to download and build our Frameworks for projects when they need it. I hate needing to do that, but it seems like the best way forward given the flux and insanity of SPM or the Xcode Project fiddling antics of CocoaPods.


Am I Alone? If so Will I Die Like This?

I suppose the point of all of this is just to validate that I'm not the crazy one here and that others have had the same experience. I'm perfectly fine with building things all the time if I need to, I'm just trying to determine the easiest path forward for my users. It doesn't seem like a Radar-Worthy® sort of thing as I get the feeling it's the expected behaviour.


So how about it? Have other folks run into this as well?