Skip to content

fix(metadata-generator): emit UIKit metadata for Mac Catalyst - #433

Open
farfromrefug wants to merge 1 commit into
NativeScript:mainfrom
Akylas:fix/mac-catalyst-metadata-upstream
Open

fix(metadata-generator): emit UIKit metadata for Mac Catalyst#433
farfromrefug wants to merge 1 commit into
NativeScript:mainfrom
Akylas:fix/mac-catalyst-metadata-upstream

Conversation

@farfromrefug

@farfromrefug farfromrefug commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Two defects in build-step-metadata-generator.py stop a Mac Catalyst build from producing usable metadata. Both were found by building a real app for platform=macOS,variant=Mac Catalyst and fixing whatever failed next.

  • Generation crashes before it starts. With EFFECTIVE_PLATFORM_NAME=-maccatalyst the script looks up MACCATALYST_DEPLOYMENT_TARGET, which Xcode does not export unless the project sets it explicitly, so it dies with KeyError: 'MACCATALYST_DEPLOYMENT_TARGET'. It now falls back to IPHONEOS_DEPLOYMENT_TARGET.

  • The generated metadata contains no UIKit. 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 parses the macOS SDK with no UIKit in scope and emits metadata without it. Every UIKit class then fails at runtime with ReferenceError: UIDevice is not defined — the app dies during require() of the first module touching UIKit. Those two search paths are now added for -maccatalyst only.

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:

symbol before after
UIDevice 0 2
UIContentSizeCategoryExtraSmall 0 1

iOS device and simulator builds are unaffected — the new search paths are behind the -maccatalyst check, and the deployment-target change is a fallback that only fires when the platform-specific variable is absent.

Note for reviewers

The IS_UIKITFORMAC check in generate_metadata is dead code: Xcode's variable has been IS_MACCATALYST for several releases, so that branch never runs and the else branch builds arm64-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

  • Bug Fixes
    • Deployment metadata generation now uses a fallback deployment target when a platform-specific value is unavailable.
    • macCatalyst builds can now locate iOS frameworks and subframeworks correctly.

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>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19269f96-a249-4bb9-8707-02f83ba9280e

📥 Commits

Reviewing files that changed from the base of the PR and between bddaacb and 658f5b1.

📒 Files selected for processing (1)
  • metadata-generator/build-step-metadata-generator.py

📝 Walkthrough

Walkthrough

The build-step metadata generator now falls back to IPHONEOS_DEPLOYMENT_TARGET when a platform-specific deployment target is unavailable. macCatalyst builds now include iOSSupport framework and subframework directories in framework search paths.

Changes

Deployment metadata generation

Layer / File(s) Summary
Deployment target and framework path handling
metadata-generator/build-step-metadata-generator.py
The generator uses IPHONEOS_DEPLOYMENT_TARGET as a fallback and adds iOSSupport framework paths for macCatalyst builds.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit checked the build path twice,
Found fallback targets, neat and precise.
For Catalyst, paths now grow,
Through iOSSupport they safely flow.
Hop, hop—metadata is nice!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the metadata-generator fix for emitting UIKit metadata during Mac Catalyst builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@farfromrefug
farfromrefug marked this pull request as ready for review August 11, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant