(claude code generated) feat: Add macOS support to Swift Package Manager build system#2815
Draft
Saadnajmi wants to merge 10 commits intomicrosoft:mainfrom
Draft
(claude code generated) feat: Add macOS support to Swift Package Manager build system#2815Saadnajmi wants to merge 10 commits intomicrosoft:mainfrom
Saadnajmi wants to merge 10 commits intomicrosoft:mainfrom
Conversation
Add native macOS platform support to React Native's SPM build system with CI workflow. The codebase already contains macOS code (tested via CocoaPods) that uses RCTUIKit.h abstraction for iOS/macOS differences. Changes: - Add macOS 14.0 platform to Package.swift - Remove macOS exclusions from Fabric components - Add conditional UIKit/AppKit framework linking - Update build script to support macOS platform - Create prebuild-macos-core.yml CI workflow - Integrate macOS build into PR validation Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Remove apple-actions/import-codesign-certs@v3 as it's not in the allowed actions list. Code signing is optional for PR validation, so simplified the workflow to skip signing steps. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Replace setup-xcode (which uses maxim-lobanov/setup-xcode) with microsoft-setup-toolchain which is allowed and sets up Node, Xcode, and other required tools for the macOS platform. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Make artifact downloads continue-on-error so the workflow can proceed even if the artifacts aren't available from upstream jobs. This allows testing the Package.swift changes even without complete dependencies. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add check to skip extraction if the ReactNativeDependencies tarball doesn't exist, preventing tar errors when artifacts aren't available. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Comment out macOS SPM build from PR validation until Hermes and ReactNativeDependencies build jobs are set up. The workflow and Package.swift changes have been verified to work locally. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add comprehensive build pipeline for macOS SPM support: - Create build-hermes-macos-spm.yml workflow to build Hermes for macOS - Use Hermes commit e0fc67142ec0763c6b6153ca2bf96df815539782 (at merge base) - Add ReactNativeDependencies build workflow call - Re-enable build-spm-macos in PR validation with proper dependencies The workflow now builds all required artifacts: 1. Hermes for macOS (Debug + Release) 2. ReactNativeDependencies including macOS slice 3. React Native SPM build for macOS Estimated CI time: ~90-120 minutes for full build pipeline Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Create build-react-native-dependencies-pr.yml workflow without disallowed actions (apple-actions/import-codesign-certs). This workflow: - Builds only macOS slice needed for SPM - Skips code signing (not needed for PR validation) - Uses microsoft-setup-toolchain (allowed action) - Creates unsigned XCFramework Update microsoft-pr.yml to use the new PR-friendly workflow instead of the full prebuild-ios-dependencies.yml which requires code signing. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add explicit yarn install step to all jobs in the ReactNativeDependencies workflow to ensure dependencies are available before running build scripts. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Add toolchain setup and explicit yarn install step before the prepare-hermes-workspace action to ensure dependencies are available. This matches the pattern used in other successful workflows. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
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
Add native macOS platform support to React Native's Swift Package Manager (SPM) build system with CI workflow. The codebase already has macOS code (tested via CocoaPods) that uses
RCTUIKit.habstraction layer to handle iOS (UIKit) vs macOS (AppKit) differences throughTARGET_OS_OSXcompile-time conditionals.Changes
Package.swift
Build Script
cli.jsto support macOS platformCI Workflow
prebuild-macos-core.ymlworkflow for building macOS slicesTesting
Validated all changes:
Related Issues
Implements macOS SPM build support to complement existing CocoaPods support.
🤖 Generated with Claude Code