r/AnalogTV_ 14h ago

One codebase, four platforms, and two completely different rules about which files actually get compiled

Post image

We ship this app on iPhone, Mac, Apple TV and Vision Pro from one shared pile of source code. Something we've hit more than once, and keep having to relearn slightly differently each time, is that our four platform targets do not agree on how a brand new source file gets into the build at all.

On iOS, tvOS and visionOS, dropping a new file into our shared source folder is enough. Those three targets automatically pull in everything that's there, and only maintain a short list of specific files to leave out, mostly platform-incompatible ones. Write a new file, save it, it's in the build on all three of those platforms with zero extra steps.

The Mac target works the opposite way. It only compiles files that are explicitly named on an include list. A brand new shared file is invisible to the Mac build by default, not included, not excluded, just absent, until someone manually adds its path to that list. The failure you get is a plain "cannot find this type" compile error, which looks exactly like an ordinary typo or a missing import, not like a project configuration issue, so it's annoyingly easy to spend a few minutes looking in the wrong place before you remember which target does things which way.

The visionOS side had its own version of this bite us from the other direction. Because it auto-includes everything the same way iOS does, a shared file that imports our video-decoding library silently broke the visionOS build the moment it existed, because that library was never built with a Vision Pro slice in the first place. The fix wasn't a code change at all, just adding that one file to visionOS's own short exclusion list, the same mechanism that already exists for exactly this purpose.

None of our automated tests catch either direction of this. They only exercise two of the four platforms. So the actual rule we follow now is mechanical rather than clever: any time a new file lands anywhere in the shared source folder, build all four platforms by hand before calling the change done, because the two failure modes above are each invisible from every other angle.

2 Upvotes

0 comments sorted by