fix(metadata-generator): emit UIKit metadata for Mac Catalyst - #433
fix(metadata-generator): emit UIKit metadata for Mac Catalyst#433farfromrefug wants to merge 1 commit into
Conversation
Two things stopped Mac Catalyst builds from producing usable metadata: - `MACCATALYST_DEPLOYMENT_TARGET` is not exported by Xcode unless the project sets it explicitly, so the script died with `KeyError` before generating anything. Fall back to `IPHONEOS_DEPLOYMENT_TARGET`. - UIKit and the other iOS-flavoured frameworks live under `System/iOSSupport` in the macOS SDK. Xcode passes those to the real compile with `-iframework`, which never reaches `FRAMEWORK_SEARCH_PATHS`, so the generator parsed the macOS SDK with no UIKit in scope and emitted metadata without it. Every UIKit class then failed at runtime with `ReferenceError: UIDevice is not defined`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe build-step metadata generator now falls back to ChangesDeployment metadata generation
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Two defects in
build-step-metadata-generator.pystop a Mac Catalyst build from producing usable metadata. Both were found by building a real app forplatform=macOS,variant=Mac Catalystand fixing whatever failed next.Generation crashes before it starts. With
EFFECTIVE_PLATFORM_NAME=-maccatalystthe script looks upMACCATALYST_DEPLOYMENT_TARGET, which Xcode does not export unless the project sets it explicitly, so it dies withKeyError: 'MACCATALYST_DEPLOYMENT_TARGET'. It now falls back toIPHONEOS_DEPLOYMENT_TARGET.The generated metadata contains no UIKit. UIKit and the other iOS-flavoured frameworks live under
System/iOSSupportin the macOS SDK. Xcode passes those to the real compile with-iframework, which never reachesFRAMEWORK_SEARCH_PATHS, so the generator parses the macOS SDK with no UIKit in scope and emits metadata without it. Every UIKit class then fails at runtime withReferenceError: UIDevice is not defined— the app dies duringrequire()of the first module touching UIKit. Those two search paths are now added for-maccatalystonly.Testing
Built a real app (OSS Weather) as a Mac Catalyst app on Apple Silicon. With both fixes it builds, signs and launches as a native macOS app — menu bar, resizable window, network and CoreLocation working.
Symbols in the generated Mac Catalyst metadata, before and after:
UIDeviceUIContentSizeCategoryExtraSmalliOS device and simulator builds are unaffected — the new search paths are behind the
-maccatalystcheck, and the deployment-target change is a fallback that only fires when the platform-specific variable is absent.Note for reviewers
The
IS_UIKITFORMACcheck ingenerate_metadatais dead code: Xcode's variable has beenIS_MACCATALYSTfor several releases, so that branch never runs and theelsebranch buildsarm64-apple-ios<sdk>-macabi, which is what actually works today. I left it alone rather than switch to an untested code path, but it is worth a follow-up.Summary by CodeRabbit