fix: include macOS slice in universal hermes xcframework#1958
Open
Saadnajmi wants to merge 3 commits intofacebook:static_hfrom
Open
fix: include macOS slice in universal hermes xcframework#1958Saadnajmi wants to merge 3 commits intofacebook:static_hfrom
Saadnajmi wants to merge 3 commits intofacebook:static_hfrom
Conversation
Consolidates the three separate Hermes Apple build scripts into a single `build-apple-framework.sh` that builds all platforms — including macOS — into one universal `hermesvm.xcframework`. Previously macOS was built as a standalone `.framework` by a separate script and excluded from the universal xcframework. This meant macOS had a different distribution path from every other Apple platform. - Merge `build-ios-framework.sh` and `build-mac-framework.sh` into `build-apple-framework.sh` using the `PLATFORMS` array as single source of truth - Update podspec to point macOS at the universal xcframework - 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 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 3, 2026
cipolleschi
approved these changes
Apr 13, 2026
Contributor
cipolleschi
left a comment
There was a problem hiding this comment.
I really like the cleanup!
Contributor
|
CI is failing to build hermesc: we might have broken some file refs... |
cipolleschi
requested changes
Apr 13, 2026
Contributor
cipolleschi
left a comment
There was a problem hiding this comment.
CI needs to be fixed.
Saadnajmi
added a commit
to microsoft/react-native-macos
that referenced
this pull request
Apr 15, 2026
## 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 `.framework` via `build-mac-framework.sh` but does **not** include it in the universal `.xcframework` used by SPM. This means SPM consumers cannot target macOS. This PR fixes that by adding `macosx` as a platform in `build-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: - facebook/hermes#1958 (`static_h` — full consolidation) ### Commit 1: SPM macOS support - Add `.macOS(.v14)` platform to `Package.swift` - Create `React-RCTUIKit` as its own SPM module with conditional UIKit/AppKit linking - Port `findMatchingHermesVersion` and `hermesCommitAtMergeBase` from Ruby to JS for Hermes version resolution - Add macOS platform and destination to prebuild CLI - Link RCTUIKit and macOS view platform headers in setup ### Commit 2: Include macOS slice in Hermes xcframework - Add `"macosx"` to `create_universal_framework` and `create_framework` in `build-ios-framework.sh` - Add `macosx` cases to `get_architecture` (x86_64;arm64) and `get_deployment_target` - Make `HERMES_PATH` overridable via env var in `build-apple-framework.sh` ### Commit 3: CI jobs - Add `microsoft-build-spm.yml` reusable workflow with two stages: - **Build Hermes**: Builds Hermes from source on `macos-15` (includes the macOS slice) - **Build SPM**: Uses the Hermes artifact to build SPM for ios, macos, and visionos on `macos-26` - Wire into PR gate in `microsoft-pr.yml` - Add `cmake-version` input to `microsoft-setup-toolchain` to allow skipping CMake installation - Add visionos/visionos-simulator as supported platforms in the ios-prebuild CLI ## Test plan - [ ] CI: Build Hermes from source with macOS slice - [ ] CI: SPM builds pass for iOS, macOS, visionOS - [ ] CocoaPods builds verified locally for iOS, macOS, visionOS 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Consolidates the three separate Hermes Apple build scripts into a single `build-apple-framework.sh` that builds all platforms — including macOS — into one universal `hermesvm.xcframework`. Previously macOS was built as a standalone `.framework` by a separate script and excluded from the universal xcframework. This meant macOS had a different distribution path from every other Apple platform. - Merge `build-ios-framework.sh` and `build-mac-framework.sh` into `build-apple-framework.sh` using the `PLATFORMS` array as single source of truth - Update podspec to point macOS at the universal xcframework - 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 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3b4b91a to
3f54159
Compare
Address review feedback: - Add build_hermesc and prepare_dest_root CLI subcommands so CI can execute the script directly instead of sourcing it - Simplify get_architecture from 5 branches to 2 - Update usage comment to document new subcommands - Remove redundant chmod +x calls (script is already 755 in git) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3f54159 to
7eacac7
Compare
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
Mirror of facebook/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
build-apple-framework.sh,build-ios-framework.sh,build-mac-framework.sh) into a singlebuild-apple-framework.shthat builds all platforms — including macOS — into one universalhermesvm.xcframeworkhermes-enginepodspec so the Pre-built subspec uses the universal xcframework for macOS (matching iOS, tvOS, and visionOS)build-apple-framework.shuniformly for all slices (no more macOS special-casing)Simpler variants of this change targeting
mainand250829098.0.0-stablejust add"macosx"to the existing build scripts without the full consolidation, since those are legacy/release branches.Test plan
CI should pass. The
build_apple_framework "macosx"codepath is already exercised by the existingbuild-mac-framework.sh— this PR just routes it through the same path as every other platform.