Uh oh!
There was an error while loading. Please reload this page.
feat: build React Native macOS with Swift Package Manager - #2815
Conversation
a22ab6e to
30d348aCompare
|
fa8de90 to
21908c3Compare## 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
01e53eeCompare01e53ee to
c1cd032Comparec1cd032 to
878f3ebCompare5fb99f5 to
16e4eb8Comparef6714d5 to
21f812cCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Tommy Nguyen (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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- 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
06372b8Compare## 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>
Uh oh!
There was an error while loading. Please reload this page.
Summary: Mirror of react/react-native#56235 The context of this change is microsoft/react-native-macos#2815, where we are adding SPM / prebuild support to React Native macOS. Currently, Hermes is compiled into 2 xcframeworks: a "macosx" one with just the macOS slice, and a "universal" one for the rest of the Apple platforms (iOS, visionOS, Mac Catalyst, tvOS, etc). This means React Native macOS needs extra diffs and patches to use the right Hermes framework. However, xcframeworks are multiplatform — there's no reason we can't just add the macOS slice to the "universal" one, making it truly universal. Including the macOS slice in the universal xcframework allows react-native-macos to use the same prebuilt Hermes artifacts as react-native for iOS, visionOS, and tvOS — without platform-specific patching. ### Changes - Consolidate the three separate Hermes Apple build scripts (`build-apple-framework.sh`, `build-ios-framework.sh`, `build-mac-framework.sh`) into a single `build-apple-framework.sh` that builds all platforms — including macOS — into one universal `hermesvm.xcframework` - Update the `hermes-engine` podspec so the Pre-built subspec uses the universal xcframework for macOS (matching iOS, tvOS, and visionOS) - Update CI workflows to use `build-apple-framework.sh` uniformly for all slices (no more macOS special-casing) - Remove standalone macOS framework validation from hermes-utils.js Simpler variants of this change targeting `main` and `250829098.0.0-stable` just add `"macosx"` to the existing build scripts without the full consolidation, since those are legacy/release branches. Pull Request resolved: #1958 Test Plan: CI should pass. The `build_apple_framework "macosx"` codepath is already exercised by the existing `build-mac-framework.sh` — this PR just routes it through the same path as every other platform. Reviewed By: cortinico Differential Revision: D104041888 Pulled By: cipolleschi fbshipit-source-id: 933021bd28dc6d0651d48b686a77ad38ac233d8c
Summary: Mirror of #1958 (targeting `static_h`), adapted for the legacy `main` branch. Unlike the `static_h` PR which consolidates all Apple build scripts and removes `build-mac-framework.sh`, this PR takes a minimal approach: it adds macOS support to the existing `build-ios-framework.sh` functions (`get_architecture`, `get_deployment_target`, `create_framework`, `build_universal_framework`) so the macOS slice is included in the universal xcframework. `build-mac-framework.sh` is left in place for backward compatibility on this legacy branch. ### Motivation The context of this change is microsoft/react-native-macos#2815, where we are adding SPM / prebuild support to React Native macOS. Including the macOS slice in the universal xcframework allows [react-native-macos](https://github.com/microsoft/react-native-macos) to use the same prebuilt Hermes artifacts as react-native for iOS, visionOS, and tvOS — without platform-specific patching. Pull Request resolved: #1970 Test Plan: CI should pass. The `build_apple_framework "macosx"` call is already exercised by `build-mac-framework.sh` — this PR just routes it through the same path as every other platform. Reviewed By: cortinico Differential Revision: D104042922 Pulled By: cipolleschi fbshipit-source-id: 4dafaf4c21361919ec240ee2cf7e3237041fecdd
## Summary Merge up to the merge base of `0.83-stable` (the first commit on the upstream `0.83-stable` branch, `a034841fd68`), prepping this branch for the 0.83 release. For the cross-platform 0.83 changes (React 19.2, DevTools, Web Performance APIs, etc.), see the [RN 0.83 release notes](https://reactnative.dev/blog/2025/12/10/react-native-0.83). New for react-native-macos since 0.81: **Build & distribution** - feat: add support for dynamic frameworks (#2943) - feat(macos): migrate init template from Objective-C to Swift (#2948) - feat(ci): prebuild React xcframework for macOS (#2920) - feat: build React Native macOS with Swift Package Manager (#2815) **SwiftUI & RCTUIKit** - fix(0.83, RCTUIKit): extend support to SwiftUI (#3006) - fix(0.83, rctuikit): make SwiftUI platform aliases visible to Swift (#3012) - fix(macos): include React-RCTUIKit.podspec in package files array (#2963) **Fabric / New Architecture on macOS** - feat: handle right clicks properly (#2885) - fix(macos): TextInput Fabric commands — setGhostText, blur, and selection fixes (#2912) - fix(fabric): textInput text color not adapting to appearance changes (#2913) - fix(fabric): multiline text input focus ring and input focus handling (#2972) - fix(fabric): force overlay scrollbar style in ScrollView (#2907) - fix(macos): don't reset prop-derived state during Fabric view recycle (#3008) - fix(macos): three Fabric focus regressions — blur, sendAccessibilityEvent, VirtualView (#3015) - fix(macos): align TouchableBounce & AccessibilityInfo with upstream (#3009) - fix: replace RCTUISecureTextField `#include` hack with proper subclass (#2895) **Hermes, autolinking & CI** - fix(0.83, hermes): resolve hermes from version files instead of merge-base (#3011) - chore: support Yarn's pnpm nodeLinker (#3010) - chore: add support for macos platform key in autolinking config (#2995) - fix(codegen): use REACT_NATIVE constant for npmPackageName (#2956) ## Test Plan CI green: JavaScript Tests (Jest/Flow/ESLint/Prettier), RNTester static builds (iOS/macOS/visionOS), and Prebuild macOS Core. Full RNTester-macOS static build also verified locally (`BUILD SUCCEEDED`).
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