diff --git a/.github/workflows/microsoft-build-rntester.yml b/.github/workflows/microsoft-build-rntester.yml index 20797e8f8d07..9dc5e92f6e54 100644 --- a/.github/workflows/microsoft-build-rntester.yml +++ b/.github/workflows/microsoft-build-rntester.yml @@ -5,7 +5,7 @@ on: jobs: build-rntester: - name: "${{ matrix.platform }}, ${{ matrix.arch }}" + name: "${{ matrix.platform }}, ${{ matrix.arch }}, ${{ matrix.linkage }}" runs-on: macos-26 timeout-minutes: 90 strategy: @@ -13,6 +13,7 @@ jobs: matrix: platform: [macos, ios, visionos] arch: [oldarch, newarch] + linkage: [static, dynamic] include: # Platform-specific properties - platform: macos @@ -32,6 +33,11 @@ jobs: new_arch_enabled: '0' - arch: newarch new_arch_enabled: '1' + # Linkage-specific properties + - linkage: static + use_frameworks: '' + - linkage: dynamic + use_frameworks: 'dynamic' steps: - uses: actions/checkout@v4 @@ -51,14 +57,27 @@ jobs: - name: Install Pods working-directory: packages/rn-tester + # Dynamic frameworks are still a work in progress on this fork (see RCT-Folly / + # header plumbing). Run those jobs for coverage but don't let pod install / build + # failures fail the check; the real result is still visible in the step logs. + # Static builds stay strict/required. + continue-on-error: ${{ matrix.linkage == 'dynamic' }} env: RCT_NEW_ARCH_ENABLED: ${{ matrix.new_arch_enabled }} + USE_FRAMEWORKS: ${{ matrix.use_frameworks }} run: | set -eox pipefail + # USE_FRAMEWORKS is empty for static-library builds; unset it so the + # Podfile keeps its default (static libraries) instead of coercing an + # empty linkage value. + if [[ -z "$USE_FRAMEWORKS" ]]; then + unset USE_FRAMEWORKS + fi bundle install bundle exec pod install --verbose - name: Build ${{ matrix.scheme }} + continue-on-error: ${{ matrix.linkage == 'dynamic' }} # [macOS] Dynamic frameworks WIP; keep the check green while building for coverage env: USE_CCACHE: 0 run: | diff --git a/.github/workflows/microsoft-prebuild-macos-core.yml b/.github/workflows/microsoft-prebuild-macos-core.yml index 878678e7efef..14c249919ebf 100644 --- a/.github/workflows/microsoft-prebuild-macos-core.yml +++ b/.github/workflows/microsoft-prebuild-macos-core.yml @@ -27,7 +27,7 @@ jobs: id: cache-slice uses: actions/cache/restore@v4 with: - key: v1-macos-core-${{ matrix.platform }}-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + key: v1-macos-core-${{ matrix.platform }}-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} path: | packages/react-native/.build/output/spm/Debug/Build/Products packages/react-native/.build/headers @@ -72,7 +72,7 @@ jobs: if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/') && endsWith(github.ref, '-stable') }} uses: actions/cache/save@v4 with: - key: v1-macos-core-${{ matrix.platform }}-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + key: v1-macos-core-${{ matrix.platform }}-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} path: | packages/react-native/.build/output/spm/Debug/Build/Products packages/react-native/.build/headers @@ -104,7 +104,7 @@ jobs: id: cache-xcframework uses: actions/cache/restore@v4 with: - key: v1-macos-core-xcframework-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + key: v1-macos-core-xcframework-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} path: | packages/react-native/.build/output/xcframeworks/ReactCoreDebug.xcframework.tar.gz packages/react-native/.build/output/xcframeworks/ReactCoreDebug.framework.dSYM.tar.gz @@ -165,7 +165,7 @@ jobs: if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/') && endsWith(github.ref, '-stable') }} uses: actions/cache/save@v4 with: - key: v1-macos-core-xcframework-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + key: v1-macos-core-xcframework-Debug-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactApple/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} path: | packages/react-native/.build/output/xcframeworks/ReactCoreDebug.xcframework.tar.gz packages/react-native/.build/output/xcframeworks/ReactCoreDebug.framework.dSYM.tar.gz diff --git a/packages/react-native/Package.swift b/packages/react-native/Package.swift index d27caa9860ef..abc9e915dff0 100644 --- a/packages/react-native/Package.swift +++ b/packages/react-native/Package.swift @@ -365,7 +365,7 @@ let reactCore = RNTarget( "ReactCommon/react/runtime/platform/ios", // explicit header search path to break circular dependency. RCTHost imports `RCTDefines.h` in ReactCore, ReacCore needs to import RCTHost ], linkedFrameworks: ["CoreServices"], - excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules", "RCTUIKit"], // [macOS] + excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules"], dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt, .reactRCTUIKit], // [macOS] sources: [".", "Runtime/RCTHermesInstanceFactory.mm"] ) @@ -543,7 +543,7 @@ let reactSettings = RNTarget( /// UIKit/AppKit compatibility layer for React Native macOS. let reactRCTUIKit = RNTarget( name: .reactRCTUIKit, - path: "React/RCTUIKit", + path: "ReactApple/Libraries/RCTUIKit", // [macOS: UIKit on iOS/visionOS, AppKit on macOS platformLinkerSettings: [ .linkedFramework("UIKit", .when(platforms: [.iOS, .visionOS])), @@ -786,7 +786,7 @@ extension String { static let reactNativeModuleDom = "React-domnativemodule" static let reactAppDelegate = "React-RCTAppDelegate" static let reactSettings = "React-RCTSettings" - static let reactRCTUIKit = "React-RCTUIKit" // [macOS] + static let reactRCTUIKit = "RCTUIKit" // [macOS] } func relativeSearchPath(_ depth: Int, _ path: String) -> String { diff --git a/packages/react-native/React-Core.podspec b/packages/react-native/React-Core.podspec index a6c86283454a..0f9bd6d34914 100644 --- a/packages/react-native/React-Core.podspec +++ b/packages/react-native/React-Core.podspec @@ -75,7 +75,6 @@ Pod::Spec.new do |s| "React/Tests/**/*", "React/Inspector/**/*", "React/Runtime/**/*", - "React/RCTUIKit/**/*", # [macOS] ] # The default is use hermes, we don't have jsc installed diff --git a/packages/react-native/React/RCTPlatformDisplayLink.h b/packages/react-native/React/RCTPlatformDisplayLink.h new file mode 100644 index 000000000000..414c4c5ad726 --- /dev/null +++ b/packages/react-native/React/RCTPlatformDisplayLink.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// [macOS] Compatibility header for existing consumers. +#import diff --git a/packages/react-native/React/RCTUIKit.h b/packages/react-native/React/RCTUIKit.h new file mode 100644 index 000000000000..fa1e198bf5cb --- /dev/null +++ b/packages/react-native/React/RCTUIKit.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// [macOS] Compatibility umbrella for existing consumers. +#import diff --git a/packages/react-native/React/RCTUIKit/RCTUIKit.h b/packages/react-native/React/RCTUIKit/RCTUIKit.h deleted file mode 100644 index 3a9c635ffc69..000000000000 --- a/packages/react-native/React/RCTUIKit/RCTUIKit.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// [macOS] -// Umbrella header for RCTUIKit — the UIKit/AppKit compatibility layer. - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import diff --git a/packages/react-native/React/RCTUIKit/RCTPlatformDisplayLink.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTPlatformDisplayLink.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTPlatformDisplayLink.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTPlatformDisplayLink.h diff --git a/packages/react-native/React/RCTUIKit/RCTPlatformDisplayLink.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTPlatformDisplayLink.m similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTPlatformDisplayLink.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTPlatformDisplayLink.m diff --git a/packages/react-native/React/RCTUIKit/RCTUIAccessibilityTraits.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIAccessibilityTraits.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUIAccessibilityTraits.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIAccessibilityTraits.h diff --git a/packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.h similarity index 95% rename from packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.h index d5700b0604d5..cde8c42aa013 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX @compatibility_alias RCTUIActivityIndicatorView UIActivityIndicatorView; diff --git a/packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.m similarity index 98% rename from packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.m index f7963452d2fd..c5361f69db83 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIActivityIndicatorView.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIActivityIndicatorView.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUIActivityIndicatorView.h" #import #import diff --git a/packages/react-native/React/RCTUIKit/RCTUIGeometry.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGeometry.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUIGeometry.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGeometry.h diff --git a/packages/react-native/React/RCTUIKit/RCTUIGraphics.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphics.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUIGraphics.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphics.h diff --git a/packages/react-native/React/RCTUIKit/RCTUIGraphics.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphics.m similarity index 97% rename from packages/react-native/React/RCTUIKit/RCTUIGraphics.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphics.m index d38f951f79bc..0d70952634e2 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIGraphics.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphics.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUIGraphics.h" #import diff --git a/packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.h similarity index 97% rename from packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.h index 0fa256c6004f..2b199656d571 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIImage.h" #if !TARGET_OS_OSX diff --git a/packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.m similarity index 95% rename from packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.m index 95c420b3b30b..54e82e756504 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIGraphicsImageRenderer.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIGraphicsImageRenderer.m @@ -9,8 +9,8 @@ #if TARGET_OS_OSX -#import -#import +#import "RCTUIGraphicsImageRenderer.h" +#import "RCTUIImage.h" @implementation RCTUIGraphicsImageRendererFormat diff --git a/packages/react-native/React/RCTUIKit/RCTUIImage.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.h similarity index 98% rename from packages/react-native/React/RCTUIKit/RCTUIImage.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.h index b09122f94481..017828dbca8a 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIImage.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX #import diff --git a/packages/react-native/React/RCTUIKit/RCTUIImage.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.m similarity index 98% rename from packages/react-native/React/RCTUIKit/RCTUIImage.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.m index b851a4198c41..b6e7cce97f68 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIImage.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImage.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUIImage.h" // UIImage diff --git a/packages/react-native/React/RCTUIKit/RCTUIImageView.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.h similarity index 89% rename from packages/react-native/React/RCTUIKit/RCTUIImageView.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.h index 4e011aa2b9e9..10bce6d413a2 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIImageView.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.h @@ -11,8 +11,8 @@ #include -#import -#import +#import "RCTUIKitCompat.h" +#import "RCTUIImage.h" #if !TARGET_OS_OSX @compatibility_alias RCTUIImageView UIImageView; diff --git a/packages/react-native/React/RCTUIKit/RCTUIImageView.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.m similarity index 98% rename from packages/react-native/React/RCTUIKit/RCTUIImageView.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.m index d2c4a4d892ab..e9899e969acd 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIImageView.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIImageView.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUIImageView.h" #import diff --git a/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKit.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKit.h new file mode 100644 index 000000000000..eccebc648400 --- /dev/null +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKit.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) Microsoft Corporation. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// [macOS] +// Umbrella header for RCTUIKit — the UIKit/AppKit compatibility layer. + +#import "RCTUIKitCompat.h" +#import "RCTUIAccessibilityTraits.h" +#import "RCTUIGeometry.h" +#import "RCTUIGraphics.h" +#import "RCTUIImage.h" +#import "RCTUIView.h" +#import "RCTUIScrollView.h" +#import "RCTUISlider.h" +#import "RCTUILabel.h" +#import "RCTUISwitch.h" +#import "RCTUIActivityIndicatorView.h" +#import "RCTUITouch.h" +#import "RCTUIImageView.h" +#import "RCTUIGraphicsImageRenderer.h" +#import "RCTPlatformDisplayLink.h" diff --git a/packages/react-native/React/RCTUIKit/RCTUIKitCompat.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKitCompat.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUIKitCompat.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKitCompat.h diff --git a/packages/react-native/React/RCTUIKit/RCTUIKitCompat.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKitCompat.m similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUIKitCompat.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIKitCompat.m diff --git a/packages/react-native/React/RCTUIKit/RCTUILabel.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.h similarity index 94% rename from packages/react-native/React/RCTUIKit/RCTUILabel.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.h index 7781effc3b6f..963bf771d464 100644 --- a/packages/react-native/React/RCTUIKit/RCTUILabel.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX @compatibility_alias RCTUILabel UILabel; diff --git a/packages/react-native/React/RCTUIKit/RCTUILabel.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.m similarity index 95% rename from packages/react-native/React/RCTUIKit/RCTUILabel.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.m index b0b6da79f8d6..919eb5641868 100644 --- a/packages/react-native/React/RCTUIKit/RCTUILabel.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUILabel.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUILabel.h" @implementation RCTUILabel {} diff --git a/packages/react-native/React/RCTUIKit/RCTUIScrollView.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.h similarity index 98% rename from packages/react-native/React/RCTUIKit/RCTUIScrollView.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.h index 3b8cb22f2605..ae7f5b972cf1 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIScrollView.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX diff --git a/packages/react-native/React/RCTUIKit/RCTUIScrollView.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.m similarity index 99% rename from packages/react-native/React/RCTUIKit/RCTUIScrollView.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.m index bdbc0c32610d..d55eac9995d8 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIScrollView.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIScrollView.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUIScrollView.h" // RCTUIScrollView diff --git a/packages/react-native/React/RCTUIKit/RCTUISlider.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.h similarity index 97% rename from packages/react-native/React/RCTUIKit/RCTUISlider.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.h index 76f4cc243d40..91f5c0557071 100644 --- a/packages/react-native/React/RCTUIKit/RCTUISlider.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX @compatibility_alias RCTUISlider UISlider; diff --git a/packages/react-native/React/RCTUIKit/RCTUISlider.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.m similarity index 92% rename from packages/react-native/React/RCTUIKit/RCTUISlider.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.m index 36e78475becb..69dce14cae41 100644 --- a/packages/react-native/React/RCTUIKit/RCTUISlider.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISlider.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUISlider.h" @implementation RCTUISlider {} diff --git a/packages/react-native/React/RCTUIKit/RCTUISwitch.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.h similarity index 93% rename from packages/react-native/React/RCTUIKit/RCTUISwitch.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.h index ef262220bcf4..18f139f4f4f4 100644 --- a/packages/react-native/React/RCTUIKit/RCTUISwitch.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX @compatibility_alias RCTUISwitch UISwitch; diff --git a/packages/react-native/React/RCTUIKit/RCTUISwitch.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.m similarity index 94% rename from packages/react-native/React/RCTUIKit/RCTUISwitch.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.m index 04d6918cf00c..6fb9acae34bb 100644 --- a/packages/react-native/React/RCTUIKit/RCTUISwitch.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUISwitch.m @@ -9,7 +9,7 @@ #if TARGET_OS_OSX -#import +#import "RCTUISwitch.h" @implementation RCTUISwitch diff --git a/packages/react-native/React/RCTUIKit/RCTUITouch.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUITouch.h similarity index 100% rename from packages/react-native/React/RCTUIKit/RCTUITouch.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUITouch.h diff --git a/packages/react-native/React/RCTUIKit/RCTUIView.h b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.h similarity index 99% rename from packages/react-native/React/RCTUIKit/RCTUIView.h rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.h index c87faaa94497..76a97c0994da 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIView.h +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.h @@ -11,7 +11,7 @@ #include -#import +#import "RCTUIKitCompat.h" #if !TARGET_OS_OSX #import diff --git a/packages/react-native/React/RCTUIKit/RCTUIView.m b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.m similarity index 99% rename from packages/react-native/React/RCTUIKit/RCTUIView.m rename to packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.m index 0976c309ff90..19528853dd6e 100644 --- a/packages/react-native/React/RCTUIKit/RCTUIView.m +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/RCTUIView.m @@ -10,7 +10,7 @@ #if TARGET_OS_OSX #import -#import +#import "RCTUIView.h" // UIView diff --git a/packages/react-native/React/RCTUIKit/README.md b/packages/react-native/ReactApple/Libraries/RCTUIKit/README.md similarity index 90% rename from packages/react-native/React/RCTUIKit/README.md rename to packages/react-native/ReactApple/Libraries/RCTUIKit/README.md index 2831f17949f5..aff6fba6eeb4 100644 --- a/packages/react-native/React/RCTUIKit/README.md +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/README.md @@ -1,5 +1,7 @@ # RCTUIKit + + RCTUIKit is a UIKit/AppKit compatibility layer for React Native macOS. It lets the rest of the codebase use UIKit-style types and APIs on both iOS and macOS by providing: @@ -11,6 +13,10 @@ codebase use UIKit-style types and APIs on both iOS and macOS by providing: - **UIKit → AppKit shims** — Constants, enums, notifications, and font defines that let code written against UIKit compile on macOS without `#if` guards everywhere. +The canonical module is `RCTUIKit`; import its umbrella as ``. Existing +`` and `` imports remain available as +compatibility entry points. + ## Naming convention: `RCTUI` vs `RCTPlatform` There are two prefixes used in this layer, and the distinction matters: @@ -41,4 +47,4 @@ For backward compatibility, the old `RCTUI` names still exist as aliases for the that were moved to `RCTPlatform`: `RCTUIColor`, `RCTUIPanGestureRecognizer`, `RCTUIApplication`. The `.m` files are wrapped in `#if TARGET_OS_OSX ... #endif` since they only contain macOS -implementations. \ No newline at end of file +implementations. diff --git a/packages/react-native/React-RCTUIKit.podspec b/packages/react-native/ReactApple/Libraries/RCTUIKit/React-RCTUIKit.podspec similarity index 78% rename from packages/react-native/React-RCTUIKit.podspec rename to packages/react-native/ReactApple/Libraries/RCTUIKit/React-RCTUIKit.podspec index 1bae5cf333f3..8c5f0e5a2186 100644 --- a/packages/react-native/React-RCTUIKit.podspec +++ b/packages/react-native/ReactApple/Libraries/RCTUIKit/React-RCTUIKit.podspec @@ -3,9 +3,11 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +# [macOS] + require "json" -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) +package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) version = package['version'] source = { :git => 'https://github.com/facebook/react-native.git' } @@ -25,12 +27,10 @@ Pod::Spec.new do |s| s.author = "Microsoft Corporation" s.platforms = min_supported_versions s.source = source - s.source_files = podspec_sources( - ["React/RCTUIKit/*.{h,m}"], - "React/RCTUIKit/*.h") - s.public_header_files = "React/RCTUIKit/*.h" - s.header_dir = "React" - s.module_name = "React_RCTUIKit" + s.source_files = podspec_sources("*.{h,m}", "*.h") + s.public_header_files = "*.h" + s.header_dir = "RCTUIKit" + s.module_name = "RCTUIKit" s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(), diff --git a/packages/react-native/scripts/ios-prebuild/setup.js b/packages/react-native/scripts/ios-prebuild/setup.js index c2cd31e65460..6c6bed31481c 100644 --- a/packages/react-native/scripts/ios-prebuild/setup.js +++ b/packages/react-native/scripts/ios-prebuild/setup.js @@ -145,7 +145,8 @@ async function setup( link('Libraries/LinkingIOS', 'React'); link('Libraries/Settings', 'React'); - link('React/RCTUIKit', 'React'); // [macOS] + link('ReactApple/Libraries/RCTUIKit', 'React'); // [macOS] + link('ReactApple/Libraries/RCTUIKit', 'RCTUIKit'); // [macOS] link('Libraries/PushNotificationIOS', 'React'); link('Libraries/Settings', 'React'); link('Libraries/Vibration', 'React'); diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index ca9a677645e3..34a7287a4e6a 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -132,7 +132,7 @@ def use_react_native! ( if !ReactNativeCoreUtils.build_rncore_from_source() pod 'React-Core-prebuilt', :podspec => "#{prefix}/React-Core-prebuilt.podspec", :modular_headers => true end - pod 'React-RCTUIKit', :path => "#{prefix}/" + pod 'React-RCTUIKit', :path => "#{prefix}/ReactApple/Libraries/RCTUIKit" # [macOS] pod 'React-Core', :path => "#{prefix}/" pod 'React-CoreModules', :path => "#{prefix}/React/CoreModules" pod 'React-RCTRuntime', :path => "#{prefix}/React/Runtime" diff --git a/packages/react-native/third-party-podspecs/RCT-Folly.podspec b/packages/react-native/third-party-podspecs/RCT-Folly.podspec index 8852179b6ce2..b2037aa3ebb0 100644 --- a/packages/react-native/third-party-podspecs/RCT-Folly.podspec +++ b/packages/react-native/third-party-podspecs/RCT-Folly.podspec @@ -49,6 +49,7 @@ Pod::Spec.new do |spec| 'folly/lang/CString.cpp', 'folly/lang/Exception.cpp', 'folly/memory/ReentrantAllocator.cpp', + 'folly/memory/SanitizeLeak.cpp', # [macOS] 'folly/memory/detail/MallocImpl.cpp', 'folly/net/NetOps.cpp', 'folly/portability/SysUio.cpp', diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index f07566c31c3f..1e4f26472004 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -21,6 +21,12 @@ end prepare_react_native_project! +# [macOS +# add_dependency() reads this while evaluating podspecs to generate +# per-platform framework header search paths for this multi-platform workspace. +$RN_PLATFORMS = %w[iOS macOS visionOS] +# macOS] + IN_CI = ENV['CI'] == 'true' @prefix_path = "../react-native" @@ -100,6 +106,25 @@ end # visionOS] post_install do |installer| - $RN_PLATFORMS = %w[iOS macOS visionOS] # [macOS] react_native_post_install(installer, @prefix_path, :mac_catalyst_enabled => false) + + # [macOS + # Disambiguate same-named per-platform framework targets. Without + # SUPPORTED_PLATFORMS, Xcode can pull multiple Hermes targets into one build + # and their script phases declare duplicate outputs. + if USE_FRAMEWORKS + supported_platforms_by_sdk = { + "iphoneos" => "iphoneos iphonesimulator", + "macosx" => "macosx", + "xros" => "xros xrsimulator", + } + installer.pods_project.native_targets.each do |target| + target.build_configurations.each do |config| + supported_platforms = supported_platforms_by_sdk[config.build_settings["SDKROOT"]] + config.build_settings["SUPPORTED_PLATFORMS"] = supported_platforms if supported_platforms + end + end + installer.pods_project.save + end + # macOS] end