mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
c95ee5ac18
Summary: This PR makes it possible to build iOS applications with Hermes. Note that it doesn't work with `use_frameworks!` just yet. Fixes https://github.com/facebook/react-native/issues/27845 (by downgrading iOS deployment target for RCT-Folly to 9.0) Fixes https://github.com/facebook/react-native/issues/28810 (as above) Checklist: - [x] Adjust release scripts to create Hermes bytecode bundle - [x] Release new Hermes npm package that includes iOS files (unreleased right now, if you want to try locally, you have to clone Hermes and `yarn link` its master to this project) - [x] Test on a new React Native application in both Debug and Release (Device) - [x] Test on an RNTester application in both Debug and Release (Device) - [x] Add missing `i386` to Hermes framework and enable Bitcode - [x] Inspect CI failures for possible regressions - [x] Resolve Folly issue as reported https://github.com/facebook/react-native/issues/27845 and https://github.com/facebook/react-native/issues/28810 - [x] Release new Hermes and test against it that everything works ## Changelog [IOS] [FEATURE] - Enable Hermes on iOS [INTERNAL] - Upgrade to CocoaPods 1.10.0 to resolve Xcode 12.0 issues [INTERNAL] - Upgrade to Xcode 12.0 on the CircleCI [INTERNAL] - Fix building RNTester in Release mode [INTERNAL] - Fix build-time errors of `libevent` with `use_frameworks!` [INTERNAL] - Introduce `USE_HERMES` variable and test all RNTester configurations on the CI [INTERNAL] - Do not fetch CocoaPods repository since we're using CDN anyway Pull Request resolved: https://github.com/facebook/react-native/pull/29914 Test Plan: Turn on `hermes_enabled` to true in your `Podfile`, install pods, and run the iOS application. Your app should be running Hermes now. Preview: (note "Engine: Hermes") <img width="395" alt="Screenshot 2020-09-09 at 19 22 32" src="https://user-images.githubusercontent.com/2464966/92631584-d7c01d80-f2d1-11ea-9b40-33d73db96a53.png"> Reviewed By: hramos Differential Revision: D24684845 Pulled By: cpojer fbshipit-source-id: 900cbe3bf9398a6fd4a773d552899a001bf5146b
125 lines
6.3 KiB
Ruby
125 lines
6.3 KiB
Ruby
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
def use_react_native! (options={})
|
|
# The prefix to the react-native
|
|
prefix = options[:path] ||= "../node_modules/react-native"
|
|
|
|
# Include Fabric dependencies
|
|
fabric_enabled = options[:fabric_enabled] ||= false
|
|
|
|
# Include DevSupport dependency
|
|
production = options[:production] ||= false
|
|
|
|
# Include Hermes dependencies
|
|
hermes_enabled = options[:hermes_enabled] ||= false
|
|
|
|
# The Pods which should be included in all projects
|
|
pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
|
|
pod 'FBReactNativeSpec', :path => "#{prefix}/Libraries/FBReactNativeSpec"
|
|
pod 'RCTRequired', :path => "#{prefix}/Libraries/RCTRequired"
|
|
pod 'RCTTypeSafety', :path => "#{prefix}/Libraries/TypeSafety"
|
|
pod 'React', :path => "#{prefix}/"
|
|
pod 'React-Core', :path => "#{prefix}/"
|
|
pod 'React-CoreModules', :path => "#{prefix}/React/CoreModules"
|
|
pod 'React-RCTActionSheet', :path => "#{prefix}/Libraries/ActionSheetIOS"
|
|
pod 'React-RCTAnimation', :path => "#{prefix}/Libraries/NativeAnimation"
|
|
pod 'React-RCTBlob', :path => "#{prefix}/Libraries/Blob"
|
|
pod 'React-RCTImage', :path => "#{prefix}/Libraries/Image"
|
|
pod 'React-RCTLinking', :path => "#{prefix}/Libraries/LinkingIOS"
|
|
pod 'React-RCTNetwork', :path => "#{prefix}/Libraries/Network"
|
|
pod 'React-RCTSettings', :path => "#{prefix}/Libraries/Settings"
|
|
pod 'React-RCTText', :path => "#{prefix}/Libraries/Text"
|
|
pod 'React-RCTVibration', :path => "#{prefix}/Libraries/Vibration"
|
|
pod 'React-Core/RCTWebSocket', :path => "#{prefix}/"
|
|
|
|
unless production
|
|
pod 'React-Core/DevSupport', :path => "#{prefix}/"
|
|
end
|
|
|
|
pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact"
|
|
pod 'React-jsi', :path => "#{prefix}/ReactCommon/jsi"
|
|
pod 'React-jsiexecutor', :path => "#{prefix}/ReactCommon/jsiexecutor"
|
|
pod 'React-jsinspector', :path => "#{prefix}/ReactCommon/jsinspector"
|
|
pod 'React-callinvoker', :path => "#{prefix}/ReactCommon/callinvoker"
|
|
pod 'React-runtimeexecutor', :path => "#{prefix}/ReactCommon/runtimeexecutor"
|
|
pod 'React-perflogger', :path => "#{prefix}/ReactCommon/reactperflogger"
|
|
pod 'ReactCommon/turbomodule/core', :path => "#{prefix}/ReactCommon"
|
|
pod 'Yoga', :path => "#{prefix}/ReactCommon/yoga", :modular_headers => true
|
|
|
|
pod 'DoubleConversion', :podspec => "#{prefix}/third-party-podspecs/DoubleConversion.podspec"
|
|
pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec"
|
|
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec"
|
|
|
|
if fabric_enabled
|
|
pod 'React-Fabric', :path => "#{prefix}/ReactCommon"
|
|
pod 'React-graphics', :path => "#{prefix}/ReactCommon/fabric/graphics"
|
|
pod 'React-jsi/Fabric', :path => "#{prefix}/ReactCommon/jsi"
|
|
pod 'React-RCTFabric', :path => "#{prefix}/React"
|
|
pod 'RCT-Folly/Fabric', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec"
|
|
end
|
|
|
|
if hermes_enabled
|
|
pod 'React-Core/Hermes', :path => "#{prefix}/"
|
|
pod 'hermes-engine'
|
|
pod 'libevent', :podspec => "#{prefix}/third-party-podspecs/libevent.podspec"
|
|
end
|
|
end
|
|
|
|
def use_flipper!(versions = {}, configurations: ['Debug'])
|
|
versions['Flipper'] ||= '~> 0.54.0'
|
|
versions['Flipper-DoubleConversion'] ||= '1.1.7'
|
|
versions['Flipper-Folly'] ||= '~> 2.2'
|
|
versions['Flipper-Glog'] ||= '0.3.6'
|
|
versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
|
|
versions['Flipper-RSocket'] ||= '~> 1.1'
|
|
pod 'FlipperKit', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configurations => configurations
|
|
# List all transitive dependencies for FlipperKit pods
|
|
# to avoid them being linked in Release builds
|
|
pod 'Flipper', versions['Flipper'], :configurations => configurations
|
|
pod 'Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], :configurations => configurations
|
|
pod 'Flipper-Folly', versions['Flipper-Folly'], :configurations => configurations
|
|
pod 'Flipper-Glog', versions['Flipper-Glog'], :configurations => configurations
|
|
pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configurations => configurations
|
|
pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configurations => configurations
|
|
pod 'FlipperKit/Core', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/CppBridge', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FBDefines', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configurations => configurations
|
|
pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configurations => configurations
|
|
end
|
|
|
|
# Post Install processing for Flipper
|
|
def flipper_post_install(installer)
|
|
installer.pods_project.targets.each do |target|
|
|
if target.name == 'YogaKit'
|
|
target.build_configurations.each do |config|
|
|
config.build_settings['SWIFT_VERSION'] = '4.1'
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
# Pre Install processing for Native Modules
|
|
def codegen_pre_install(installer, options={})
|
|
prefix = options[:path] ||= "../node_modules/react-native"
|
|
codegen_path = options[:codegen_path] ||= "../node_modules/react-native-codegen"
|
|
|
|
Dir.mktmpdir do |dir|
|
|
native_module_spec_name = "FBReactNativeSpec"
|
|
schema_file = dir + "/schema-#{native_module_spec_name}.json"
|
|
srcs_dir = "#{prefix}/Libraries"
|
|
schema_generated = system("node #{codegen_path}/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
|
|
specs_generated = system("node #{prefix}/scripts/generate-native-modules-specs-cli.js ios #{schema_file} #{srcs_dir}/#{native_module_spec_name}/#{native_module_spec_name}")
|
|
end
|
|
end
|