Skip to content

feat: build hermes-windows for apple platforms#302

Draft
Saadnajmi wants to merge 3 commits intomicrosoft:mainfrom
Saadnajmi:saad/add-macos-to-xcframework
Draft

feat: build hermes-windows for apple platforms#302
Saadnajmi wants to merge 3 commits intomicrosoft:mainfrom
Saadnajmi:saad/add-macos-to-xcframework

Conversation

@Saadnajmi
Copy link
Copy Markdown

@Saadnajmi Saadnajmi commented Apr 7, 2026

Summary

Expands the hermes-windows build to also produce macOS (Apple) framework slices. Currently hermes-windows only builds Windows targets (UWP/Win32). This PR adds macOS to the universal hermesvm.xcframework and introduces Apple framework CI jobs to the Azure Pipelines build.

This mirrors the changes from facebook/hermes#1970 (upstream main) and facebook/hermes#1958 (upstream static_h), adapted for hermes-windows.

Build script changes

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.

Podspec changes

  • spec.osx.vendored_frameworks now points to universal/hermesvm.xcframework (matching iOS, tvOS, visionOS)
  • prepare_command no longer calls build-mac-framework.sh separately — macOS is now built by build-ios-framework.sh

Azure Pipelines CI

Adds Apple framework build jobs to .ado/build-template.yml using the 1ES template with Microsoft-hosted macOS agents (Azure Pipelines pool, macOS-15 image):

  1. Build_HermesC_Apple — builds the host hermesc compiler on macOS
  2. Build_Apple_<slice>_<flavor> — 16 parallel jobs (8 platform slices × Debug/Release) building per-platform frameworks
  3. Build_Apple_XCFramework_<flavor> — assembles all slices into the universal xcframework + dSYM archive

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

  • Azure Pipelines Apple build jobs trigger and complete successfully on macOS agents
  • All 8 Apple slices build (including macosx via build-ios-framework.sh)
  • Universal xcframework contains a macos-arm64_x86_64 slice
  • build-mac-framework.sh still works standalone for local dev

🤖 Generated with Claude Code

@vmoroz
Copy link
Copy Markdown
Member

vmoroz commented Apr 7, 2026

@Saadnajmi , the changes to the build-template look too big.
We use a different approach in the hermes-windows.
All builds must be driven from the build.js. This way we will have same way to build code locally or in the pipeline.
The pipeline changes must be minimal just to enable running the build.js code.
The build.js is responsible for building, testing, and packaging.

@Saadnajmi Saadnajmi changed the title fix: include macOS slice in universal Hermes xcframework feat: build hermes-windows for apple platforms Apr 8, 2026
Saadnajmi and others added 3 commits April 7, 2026 22:02
Wire macOS into build-ios-framework.sh alongside the existing iOS,
tvOS, visionOS, and Catalyst slices so that the universal
hermesvm.xcframework includes a macOS slice (x86_64 + arm64).

Changes:
- build-ios-framework.sh: add macosx to get_architecture,
  get_deployment_target, build_universal_framework, create_framework
- build-apple-framework.sh: fix get_release_version to fall back to
  CMakeLists.txt when npm/hermes-compiler/package.json is missing
  (hermes-windows fork); fix build_host_hermesc to explicitly target
  macOS with correct sysroot and bypass CheckAtomic.cmake
- hermes-engine.podspec: point osx vendored_frameworks at the
  universal xcframework; remove separate build-mac-framework.sh call

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TypeScript build script (runs natively on Node 22+) that orchestrates
Hermes Apple framework builds. Follows the same patterns as build.js:

- All action flags default to true, so running with no args performs a
  full local build (hermesc -> all 8 slices -> xcframework)
- CI uses --no-* flags for selective phases (e.g. --no-build
  --no-build-xcframework to build only hermesc)
- Validates outputs after each phase (framework, dSYM, xcframework)
- Supports --create-dsym-archive for CI dSYM packaging
- Delegates to upstream shell scripts for actual CMake/Xcode work

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Apple build stage to the 1ES pipeline template and a standalone
Apple pipeline for environments without 1ES macOS support.

Structure (3 phases, matching the Windows matrix pattern):
1. Build host hermesc compiler (single macOS job)
2. Build platform slices in parallel (8 slices x 2 flavors = 16 jobs)
3. Assemble universal xcframework per flavor (2 jobs)

Each job calls build-apple.mts with selective --no-* flags. YAML
handles only artifact orchestration, Xcode setup, and pool config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Saadnajmi Saadnajmi force-pushed the saad/add-macos-to-xcframework branch from 2d74ede to 7554e86 Compare April 8, 2026 05:02
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.

2 participants