Skip to content

fix: include macOS slice in universal Hermes xcframework#1971

Open
Saadnajmi wants to merge 1 commit intofacebook:250829098.0.0-stablefrom
Saadnajmi:saad/add-macos-to-xcframework-stable
Open

fix: include macOS slice in universal Hermes xcframework#1971
Saadnajmi wants to merge 1 commit intofacebook:250829098.0.0-stablefrom
Saadnajmi:saad/add-macos-to-xcframework-stable

Conversation

@Saadnajmi
Copy link
Copy Markdown

Summary

Mirror of #1958 (targeting static_h), adapted for the 250829098.0.0-stable release 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 build_apple_framework "macosx" and includes "macosx" in the create_universal_framework call so the macOS slice is part of the universal xcframework.

build-mac-framework.sh is left in place for backward compatibility on this release 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 to use the same prebuilt Hermes artifacts as react-native for iOS, visionOS, and tvOS — without platform-specific patching.

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.

@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Apr 3, 2026
Copy link
Copy Markdown
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change the build-ios-framework script, but shouldn't we also update the CI?

Otherwise CI will still call the other script as we build the slices in their own action.

…_architecture

- Add macosx to get_architecture, get_deployment_target, create_framework,
  and build_universal_framework so the unified script handles all platforms
- Simplify get_architecture from 5 branches to 2
- CI continues using build-mac-framework-rn.sh for the standalone macOS
  framework (needed by the podspec), while the assembly step now includes
  macosx in the universal xcframework via build_universal_framework

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Saadnajmi Saadnajmi force-pushed the saad/add-macos-to-xcframework-stable branch from a8098ad to 36906cc Compare April 15, 2026 20:51
@Saadnajmi
Copy link
Copy Markdown
Author

this change the build-ios-framework script, but shouldn't we also update the CI?

Otherwise CI will still call the other script as we build the slices in their own action.

Similar to the comment for the main branch PR, I think before my change we always had a macos slice and job in CI, and after this change we make sure that that slice is also in the universal xcframework by adding macos to build_universal_framework()

Saadnajmi added a commit to microsoft/react-native-macos that referenced this pull request Apr 18, 2026
## Summary

Overhauls the macOS SPM prebuild CI pipeline, renaming it from "Build
SwiftPM" to "Prebuild macOS Core" to align with upstream's
`prebuild-ios-core.yml` convention.

### Hermes resolution (`microsoft-resolve-hermes.yml`)
- Extract Hermes build into a separate reusable workflow (`Resolve
Hermes`)
- Download upstream Hermes tarball from Maven/Sonatype and recompose the
xcframework to include the macOS slice — avoids ~90 min
build-from-source
- Check if macOS is already in the universal xcframework before
recomposing (future-proofing for upstream Hermes PRs:
[#1958](facebook/hermes#1958),
[#1970](facebook/hermes#1970),
[#1971](facebook/hermes#1971))
- Fall back to resolving the Hermes commit at the merge base with
facebook/react-native → cache check → build from source

### Prebuild pipeline (`microsoft-prebuild-macos-core.yml`)
- Expand build matrix to include `ios-simulator` and
`visionos-simulator` slices
- Add `compose-xcframework` job that assembles all slices into
`React.xcframework` with dSYMs
- Add content-hash caching for slice builds and composed xcframework
(save on main and any stable branch)
- Fix Hermes version marker mismatch (`HERMES_VERSION=prebuilt` bypasses
version resolution entirely)
- Use `microsoft-setup-toolchain` action consistently across all Hermes
build jobs
- Add macOS and visionOS to `extractDestinationFromPath` for dSYM symbol
copying

### Script refactoring
- Rename `macosVersionResolver.js` → `microsoft-hermes.js`
- Move CI-specific logic (download, recompose, CLI dispatch) to
`.github/scripts/resolve-hermes.mts` using the existing zx pattern
- Keep `microsoft-hermes.js` as a pure library (version resolution,
merge base commit lookup)
- Use Node's `parseArgs` for CLI argument parsing
- Fix `createRequire` interop for importing CommonJS modules from ESM
`.mts` script

## Test plan

- [ ] All 5 build jobs pass (ios, ios-simulator, macos, visionos,
visionos-simulator)
- [ ] `compose-xcframework` job succeeds
- [ ] `ReactCoreDebug.xcframework.tar.gz` artifact is downloadable from
GitHub Actions
- [ ] Downloaded xcframework contains all expected platform slices
- [ ] Cache hit skips build on subsequent runs with same source hash
- [ ] Hermes resolve fast path downloads and recomposes upstream tarball
(~1 min vs ~90 min)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Saadnajmi added a commit to microsoft/react-native-macos that referenced this pull request Apr 18, 2026
## Summary

Backport of #2920 to `0.81-stable`.

Overhauls the macOS SPM prebuild CI pipeline, renaming it from "Build
SwiftPM" to "Prebuild macOS Core" to align with upstream's
`prebuild-ios-core.yml` convention.

### Hermes resolution (`microsoft-resolve-hermes.yml`)
- Extract Hermes build into a separate reusable workflow (`Resolve
Hermes`)
- Download upstream Hermes tarball from Maven and recompose the
xcframework to include the macOS slice — avoids ~90 min
build-from-source
- Check if macOS is already in the universal xcframework before
recomposing (future-proofing for upstream Hermes PRs:
[#1958](facebook/hermes#1958),
[#1970](facebook/hermes#1970),
[#1971](facebook/hermes#1971))
- Fall back to resolving the Hermes commit at the merge base with
facebook/react-native → cache check → build from source

### Prebuild pipeline (`microsoft-prebuild-macos-core.yml`)
- Expand build matrix to include `ios-simulator` and
`visionos-simulator` slices
- Add `compose-xcframework` job that assembles all slices into
`React.xcframework` with dSYMs
- Add content-hash caching for slice builds and composed xcframework
(save on main and any stable branch)
- Fix Hermes version marker mismatch (`HERMES_VERSION=prebuilt` bypasses
version resolution entirely)
- Use `microsoft-setup-toolchain` action consistently across all Hermes
build jobs

### Script refactoring
- Rename `macosVersionResolver.js` → `microsoft-hermes.js`
- Add CLI entry point, recompose function, and flow comments directly in
`microsoft-hermes.js` (0.81 doesn't have `.github/scripts/` zx pattern)
- Use `void` prefix for async CLI dispatch to satisfy Flow
`unused-promise` lint
- Add `visionos-simulator` platform to `ios-prebuild` CLI (already
present on main)

## Test plan

- [ ] All 5 build jobs pass (ios, ios-simulator, macos, visionos,
visionos-simulator)
- [ ] `compose-xcframework` job succeeds
- [ ] `ReactCoreDebug.xcframework.tar.gz` artifact is downloadable from
GitHub Actions
- [ ] Downloaded xcframework contains all expected platform slices
- [ ] Cache hit skips build on subsequent runs with same source hash
- [ ] Hermes resolve fast path downloads and recomposes upstream tarball
(~1 min vs ~90 min)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants