feat: build React Native macOS with Swift Package Manager#2815
Merged
Saadnajmi merged 6 commits intomicrosoft:mainfrom Apr 15, 2026
Merged
feat: build React Native macOS with Swift Package Manager#2815Saadnajmi merged 6 commits intomicrosoft:mainfrom
Saadnajmi merged 6 commits intomicrosoft:mainfrom
Conversation
a22ab6e to
30d348a
Compare
|
2 tasks
fa8de90 to
21908c3
Compare
Saadnajmi
added a commit
that referenced
this pull request
Mar 23, 2026
## Summary Fixes compilation errors that block macOS SPM builds, helping unblock #2815. - **RCTLinkingManager**: combined iOS and macOS implementations into a single file using `#if TARGET_OS_OSX` guards. Added missing `NativeLinkingManagerSpec` conformance (`openSettings`, `sendIntent`, `getTurboModule`), removed unused import, deleted the `macos/` overlay directory, and cleaned up the podspec - **RCTCursor.m**: replaced `Foundation.h` + conditional `AppKit.h` with `RCTUIKit` umbrella header - **RCTViewComponentView.mm**: removed duplicate `cursor` property check introduced during merge ## Test plan - [x] macOS SPM build passes (verified on `feature/spm-macos-support` — zero errors from these files) - [ ] Verify iOS build is not regressed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
d1b4bcd to
01e53ee
Compare
01e53ee to
c1cd032
Compare
c1cd032 to
878f3eb
Compare
5fb99f5 to
16e4eb8
Compare
Add microsoft-build-spm.yml with 4-stage pipeline: 1. resolve-hermes: find Hermes commit, check cache 2. build-hermesc + build-hermes-slice (5x parallel): build from source 3. assemble-hermes: create universal xcframework, save cache 4. build-spm (ios/macos/visionos): build SPM packages The assembled Hermes xcframework is cached by commit hash, so ~95% of CI runs skip the entire Hermes build and go straight to SPM builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
89b00ec to
f6714d5
Compare
- Rename workflow to "Build SwiftPM" (tido64) - Replace shallow clone + fetch with actions/checkout for Hermes (tido64) - Use efficient git init + fetch pattern in buildFromHermesCommit (tido64) - Extract reusable build env object in hermes.js (tido64) - Move macOS version resolution to fork-only macosVersionResolver.js (tido64) - Replace platformLinkerSettings with #if os(macOS) in Package.swift (Saad) - Revert CMAKE_OSX_DEPLOYMENT_TARGET from build-apple-framework.sh (Saad) - Add // [macOS] tag to os require in hermes.js (tido64) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f6714d5 to
21f812c
Compare
Saadnajmi
commented
Apr 10, 2026
9 tasks
tido64
approved these changes
Apr 13, 2026
Member
tido64
left a comment
There was a problem hiding this comment.
I've only reviewed the code as this can't really be tested atm.
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
Saadnajmi
commented
Apr 14, 2026
- Add missing [macOS] diff tags across Package.swift, hermes.js, and
shell build scripts per the diff tag guide
- Move macosx case to bottom of get_deployment_target elif chain to
minimize upstream diff in build-ios-framework.sh
- Remove hermes.js re-exports; import directly from macosVersionResolver
- Extract {stdio: 'inherit'} to const in buildFromHermesCommit
- Add HERMES_PATH override comment in build-apple-framework.sh
- Increase CI artifact retention-days from 1 to 30
- Add commented-out lines for removed upstream excludes in Package.swift
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5bb6a84 to
06372b8
Compare
Saadnajmi
added a commit
that referenced
this pull request
Apr 15, 2026
## Summary - Backports SPM macOS support from #2815 (main branch) to 0.81-stable - Key adaptation: RCTUIKit is part of React-Core on 0.81 (not a separate module), so `platformLinkerSettings` for UIKit/AppKit go directly on the `reactCore` target - Adds macOS/visionOS platform support, Hermes CI pipeline, and macOS view platform conditionals ## Changes from main branch PR - No separate `reactRCTUIKit` target — UIKit/AppKit compat is inside React-Core - `platformLinkerSettings` on `reactCore` instead of `reactRCTUIKit` - No `RCTUIKit` header link in setup.js (not needed since it's part of React-Core) - `ENTERPRISE_REPOSITORY` env var preserved in `getTarballUrl` (0.81-specific) ## Test plan - [ ] CI: resolve-hermes job passes - [ ] CI: build-hermesc job passes - [ ] CI: all hermes slice builds pass (iphoneos, iphonesimulator, catalyst, macosx, xros) - [ ] CI: assemble-hermes produces xcframework - [ ] CI: SPM ios build passes - [ ] CI: SPM macos build passes - [ ] CI: SPM visionos build passes - [ ] Local: `node scripts/prebuild-ios -s -f Debug` completes setup - [ ] Local: `node scripts/prebuild-ios -b -f Debug -p macos` builds for macOS 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the Hermes build scripts to include macOS slices in the universal xcframework, and adds macOS support to the Swift Package Manager build system.
Currently, Hermes builds a standalone macOS
.frameworkviabuild-mac-framework.shbut does not include it in the universal.xcframeworkused by SPM. This means SPM consumers cannot target macOS. This PR fixes that by addingmacosxas a platform inbuild-ios-framework.sh, so the macOS slice is built alongside iOS, visionOS, tvOS, and catalyst — and included in the universal xcframework.This mirrors the upstream Hermes changes:
static_h— full consolidation)Commit 1: SPM macOS support
.macOS(.v14)platform toPackage.swiftReact-RCTUIKitas its own SPM module with conditional UIKit/AppKit linkingfindMatchingHermesVersionandhermesCommitAtMergeBasefrom Ruby to JS for Hermes version resolutionCommit 2: Include macOS slice in Hermes xcframework
"macosx"tocreate_universal_frameworkandcreate_frameworkinbuild-ios-framework.shmacosxcases toget_architecture(x86_64;arm64) andget_deployment_targetHERMES_PATHoverridable via env var inbuild-apple-framework.shCommit 3: CI jobs
microsoft-build-spm.ymlreusable workflow with two stages:macos-15(includes the macOS slice)macos-26microsoft-pr.ymlcmake-versioninput tomicrosoft-setup-toolchainto allow skipping CMake installationTest plan
🤖 Generated with Claude Code