mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This is a change we have implemented in React Native macOS that I am now upstreaming: https://github.com/microsoft/react-native-macos/pull/1257 The library `ocMock` is currently imported as a checked in binary by RN-Tester to help run unit tests on iOS. That binary is only compiled for x86 on macOS, which meant we could not run tests on M1 / M2 Macs. Switching it so that we import from source as a pod should make maintenance easier for both iOS and macOS! :) Original change notes: >Previously, we've been unable to test RNTester for macOS on an M1 machine. This is because we were using a framework that was prebuilt for Intel architecture, so the test components would fail to build. > > The fix is to build OCMock from source directly instead of using a prebuilt version. > > This is only necessary on macOS. The iOS version is already built for ARM architecture, as iOS devices have been running exclusively on ARM for a while now. ## Changelog [INTERNAL] [CHANGED] - Import OCMock as a pod Pull Request resolved: https://github.com/facebook/react-native/pull/36239 Test Plan: CI should pass as it did before. Reviewed By: dmytrorykun Differential Revision: D43732219 Pulled By: cipolleschi fbshipit-source-id: 028b5a7f384042145bf1966c8c2730d7437940ec
77 lines
2.5 KiB
Ruby
77 lines
2.5 KiB
Ruby
require_relative '../../scripts/react_native_pods'
|
|
|
|
source 'https://cdn.cocoapods.org/'
|
|
platform :ios, min_ios_version_supported
|
|
|
|
prepare_react_native_project!
|
|
|
|
IN_CI = ENV['CI'] == 'true'
|
|
|
|
@prefix_path = "../.."
|
|
|
|
linkage = ENV['USE_FRAMEWORKS']
|
|
USE_FRAMEWORKS = linkage != nil
|
|
if USE_FRAMEWORKS
|
|
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
|
|
use_frameworks! :linkage => linkage.to_sym
|
|
end
|
|
|
|
def pods(target_name, options = {}, use_flipper: !IN_CI && !USE_FRAMEWORKS)
|
|
project 'RNTesterPods.xcodeproj'
|
|
|
|
fabric_enabled = ENV['USE_FRAMEWORKS'] == 'dynamic' ? false : true
|
|
|
|
# Hermes is now enabled by default.
|
|
# The following line will only disable Hermes if the USE_HERMES envvar is SET to a value other than 1 (e.g. USE_HERMES=0).
|
|
hermes_enabled = !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1'
|
|
puts "Configuring #{target_name} with Fabric #{fabric_enabled ? "enabled" : "disabled"}.#{hermes_enabled ? " Using Hermes engine." : ""}"
|
|
|
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
# Custom fabric component is only supported when using codegen discovery.
|
|
pod 'MyNativeView', :path => "NativeComponentExample"
|
|
end
|
|
|
|
use_react_native!(
|
|
path: @prefix_path,
|
|
fabric_enabled: fabric_enabled,
|
|
hermes_enabled: hermes_enabled,
|
|
flipper_configuration: use_flipper ? FlipperConfiguration.enabled : FlipperConfiguration.disabled,
|
|
app_path: "#{Dir.pwd}",
|
|
config_file_dir: "#{Dir.pwd}/node_modules",
|
|
production: !ENV['PRODUCTION'].nil?,
|
|
ios_folder: '.',
|
|
)
|
|
pod 'ReactCommon/turbomodule/samples', :path => "#{@prefix_path}/ReactCommon"
|
|
|
|
# Additional Pods which aren't included in the default Podfile
|
|
pod 'React-RCTPushNotification', :path => "#{@prefix_path}/Libraries/PushNotificationIOS"
|
|
pod 'Yoga', :path => "#{@prefix_path}/ReactCommon/yoga", :modular_headers => true
|
|
# Additional Pods which are classed as unstable
|
|
|
|
# RNTester native modules and components
|
|
pod 'ScreenshotManager', :path => "NativeModuleExample"
|
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
pod 'NativeCxxModuleExample', :path => "NativeCxxModuleExample"
|
|
end
|
|
end
|
|
|
|
target 'RNTester' do
|
|
pods('RNTester')
|
|
end
|
|
|
|
target 'RNTesterUnitTests' do
|
|
pods('RNTesterUnitTests')
|
|
pod 'React-RCTTest', :path => "./RCTTest"
|
|
pod 'OCMock', '~> 3.9.1'
|
|
end
|
|
|
|
target 'RNTesterIntegrationTests' do
|
|
pods('RNTesterIntegrationTests')
|
|
pod 'React-RCTTest', :path => "./RCTTest"
|
|
end
|
|
|
|
post_install do |installer|
|
|
react_native_post_install(installer, @prefix_path, :mac_catalyst_enabled => false)
|
|
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
|
end
|