Currently on iOS, Nimbus and Glean are always compiled together as
part of the same Swift module in the iOS megazord. This means that
Nimbus can see and use many of Glean's internal helper functions,
which in fact it does.
When we switch to distributing via Swift packages, we'll need to
be more careful about inter-module hygiene. I think ideally the
Nimbus Swift code would consume Glean as an ordinary Swift dependency
via `import Glean`.
To make that work while also preserving the current behaviour for
current consumers, I have:
* Added a conditional import of Glean, which gets ignored in the
existing megazord but makes Glean available in a Swift package build.
* Copied the internal helper modules that we were using from Glean
into the `nimbus/ios` directory, so that this directory can be
compiled as a standalone Swift module using only public Glean
APIs.
Importantly, I have *not* included the copied utility files in the
iOS megazord Xcode project. That build already uses the ones from
Glean and would error out if we included duplicates.
All in all, this doesn't seem like a sustainable setup, but perhaps
it can be the first step towards something cleaner. Maybe we could
make a shared utility module that both Glean and Nimbus can depend
on? Maybe Glean could commit to making these utilities part of its
public API surface?
Suggestions welcome! What I know is that this helps unblock the work
on publishing as a Swift package in the meantime. Fixes#4308.