mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
4246c75d0d
Summary: allow-large-files This bumps the flipper dependencies to 0.91. Fresco deps are not in mavenCentral jet, so picked those from bintray, but pinged the team and they'll follow up on it. See also: https://github.com/facebook/fresco/issues/2603 This primarily bumps to the latest pods we have everywhere, which solves several build issues, like reported in https://github.com/facebook/react-native/issues/31480 After this change it should no longer be needed to pass custom version overrides to `use_flipper`, as the defaults will be up to date. In the template project, I changed the version rangers to exact numbers, so that results of `react-native init` are more consistent / predictable over time, as suggested in the discord channel by Brent In the long term we are investigating whether we can remove most of the transitive deps by not using RSocket, which is a bigger project plan that should help reduce build issues and times, especially on iOS. cc priteshrnandgaonkar passy kelset ## Changelog [general][changed] - [iOS] Update Flipper to 0.91.1, fixed iOS build support for i386, `use_flipper!()` will no longer need custom overrides to build with XCode 12.5 Pull Request resolved: https://github.com/facebook/react-native/pull/31562 Test Plan: _N.B. Locally tested in XCode 12.4 only, but bumped versions have been confirmed to work on 12.5 before by others_ * React Native CI * Flipper CI with same versions of deps: https://github.com/facebook/flipper/actions/runs/863607686 * Was able to connect from both Android and iOS to Flipper. Couldn't really test further due to a bundling error I didn't understand, suggestions welcome   Reviewed By: fkgozali Differential Revision: D28623601 Pulled By: mweststrate fbshipit-source-id: 22130d07821569851956453c4ee6a594b6b83928
203 lines
9.0 KiB
Ruby
203 lines
9.0 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 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}/React/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/react/renderer/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-hermes', :path => "#{prefix}/ReactCommon/hermes"
|
|
pod 'hermes-engine'
|
|
pod 'libevent', '~> 2.1.12'
|
|
end
|
|
end
|
|
|
|
def use_flipper!(versions = {}, configurations: ['Debug'])
|
|
versions['Flipper'] ||= '0.91.1'
|
|
versions['Flipper-Boost-iOSX'] ||= '1.76.0.1.11'
|
|
versions['Flipper-DoubleConversion'] ||= '3.1.7'
|
|
versions['Flipper-Fmt'] ||= '7.1.7'
|
|
versions['Flipper-Folly'] ||= '2.6.7'
|
|
versions['Flipper-Glog'] ||= '0.3.6'
|
|
versions['Flipper-PeerTalk'] ||= '0.0.4'
|
|
versions['Flipper-RSocket'] ||= '1.4.3'
|
|
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-Boost-iOSX', versions['Flipper-Boost-iOSX'], :configurations => configurations
|
|
pod 'Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], :configurations => configurations
|
|
pod 'Flipper-Fmt', versions['Flipper-Fmt'], :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
|
|
|
|
def has_pod(installer, name)
|
|
installer.pods_project.pod_group(name) != nil
|
|
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
|
|
|
|
def exclude_architectures(installer)
|
|
projects = installer.aggregate_targets
|
|
.map{ |t| t.user_project }
|
|
.uniq{ |p| p.path }
|
|
.push(installer.pods_project)
|
|
|
|
arm_value = `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i
|
|
|
|
# Hermes does not support `i386` architecture
|
|
excluded_archs_default = has_pod(installer, 'hermes-engine') ? "i386" : ""
|
|
|
|
projects.each do |project|
|
|
project.build_configurations.each do |config|
|
|
if arm_value == 1 then
|
|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
|
|
else
|
|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 " + excluded_archs_default
|
|
end
|
|
end
|
|
|
|
project.save()
|
|
end
|
|
end
|
|
|
|
def react_native_post_install(installer)
|
|
if has_pod(installer, 'Flipper')
|
|
flipper_post_install(installer)
|
|
end
|
|
|
|
exclude_architectures(installer)
|
|
end
|
|
|
|
def use_react_native_codegen!(spec, options={})
|
|
return if ENV['DISABLE_CODEGEN'] == '1'
|
|
|
|
# The path to react-native
|
|
prefix = options[:path] ||= "${PODS_TARGET_SRCROOT}/../.."
|
|
|
|
# The path to JavaScript files
|
|
js_srcs = options[:js_srcs_dir] ||= "#{prefix}/Libraries"
|
|
|
|
# Library name (e.g. FBReactNativeSpec)
|
|
modules_library_name = spec.name
|
|
modules_output_dir = "React/#{modules_library_name}/#{modules_library_name}"
|
|
|
|
# Run the codegen as part of the Xcode build pipeline.
|
|
env_vars = "SRCS_DIR='#{js_srcs}'"
|
|
env_vars += " MODULES_OUTPUT_DIR='#{prefix}/#{modules_output_dir}'"
|
|
env_vars += " MODULES_LIBRARY_NAME='#{modules_library_name}'"
|
|
|
|
generated_dirs = [ modules_output_dir ]
|
|
generated_filenames = [ "#{modules_library_name}.h", "#{modules_library_name}-generated.mm" ]
|
|
generated_files = generated_filenames.map { |filename| "#{modules_output_dir}/#{filename}" }
|
|
|
|
if ENV['USE_FABRIC'] == '1'
|
|
# We use a different library name for components, as well as an additional set of files.
|
|
# Eventually, we want these to be part of the same library as #{modules_library_name} above.
|
|
components_output_dir = "ReactCommon/react/renderer/components/rncore/"
|
|
generated_dirs.push components_output_dir
|
|
env_vars += " COMPONENTS_OUTPUT_DIR='#{prefix}/#{components_output_dir}'"
|
|
components_generated_filenames = [
|
|
"ComponentDescriptors.h",
|
|
"EventEmitters.cpp",
|
|
"EventEmitters.h",
|
|
"Props.cpp",
|
|
"Props.h",
|
|
"RCTComponentViewHelpers.h",
|
|
"ShadowNodes.cpp",
|
|
"ShadowNodes.h"
|
|
]
|
|
generated_files = generated_files.concat(components_generated_filenames.map { |filename| "#{components_output_dir}/#{filename}" })
|
|
end
|
|
|
|
spec.script_phase = {
|
|
:name => 'Generate Specs',
|
|
:input_files => [js_srcs],
|
|
:output_files => ["${DERIVED_FILE_DIR}/codegen-#{modules_library_name}.log"].concat(generated_files.map { |filename| "#{prefix}/#{filename}"} ),
|
|
:script => "set -o pipefail\n\nbash -l -c '#{env_vars} ${PODS_TARGET_SRCROOT}/../../scripts/generate-specs.sh' 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"",
|
|
:execution_position => :before_compile,
|
|
:show_env_vars_in_log => true
|
|
}
|
|
spec.prepare_command = "mkdir -p #{generated_dirs.map {|dir| "'../../#{dir}'"}.join(" ")} && touch #{generated_files.map {|file| "'../../#{file}'"}.join(" ")}"
|
|
end
|