mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Always install all the pods (#41588)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41588 This change always installs all the Pods for both architecture. This unify the behavior between iOS and Android. ## Changelog: [Internal] - Always install all the pods ## Facebook: The inly four pods that are changed when flipping between the new and the old arch with RNTester are: - MyNativeView - NativeCxxModuleExample - React-RCTAppDelegate - ScreenshotManager The only change there is the RCt_NEW_ARCH_ENABLED flag being set or not in those pods Reviewed By: dmytrorykun Differential Revision: D51494498 fbshipit-source-id: 4cafdef4a4c2b86381067373aed27ed18524e4be
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a6076924bf
commit
6b5320540a
@@ -80,42 +80,33 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-NativeModulesApple")
|
||||
add_dependency(s, "React-runtimescheduler")
|
||||
add_dependency(s, "React-RCTFabric", :framework_name => "RCTFabric")
|
||||
|
||||
if is_new_arch_enabled
|
||||
add_dependency(s, "React-RuntimeCore")
|
||||
add_dependency(s, "React-RuntimeApple")
|
||||
if use_hermes
|
||||
s.dependency "React-RuntimeHermes"
|
||||
end
|
||||
end
|
||||
add_dependency(s, "React-RuntimeCore")
|
||||
add_dependency(s, "React-RuntimeApple")
|
||||
add_dependency(s, "React-Fabric", :additional_framework_paths => ["react/renderer/components/view/platform/cxx"])
|
||||
add_dependency(s, "React-graphics", :additional_framework_paths => ["react/renderer/graphics/platform/ios"])
|
||||
add_dependency(s, "React-utils")
|
||||
add_dependency(s, "React-debug")
|
||||
add_dependency(s, "React-rendererdebug")
|
||||
|
||||
if use_hermes
|
||||
s.dependency "React-hermes"
|
||||
s.dependency "React-RuntimeHermes"
|
||||
else
|
||||
s.dependency "React-jsc"
|
||||
end
|
||||
|
||||
if is_new_arch_enabled
|
||||
add_dependency(s, "React-Fabric", :additional_framework_paths => ["react/renderer/components/view/platform/cxx"])
|
||||
add_dependency(s, "React-graphics", :additional_framework_paths => ["react/renderer/graphics/platform/ios"])
|
||||
add_dependency(s, "React-utils")
|
||||
add_dependency(s, "React-debug")
|
||||
add_dependency(s, "React-rendererdebug")
|
||||
rel_path_from_pods_root_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(Pod::Config.instance.installation_root)
|
||||
rel_path_from_pods_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(File.join(Pod::Config.instance.installation_root, 'Pods'))
|
||||
|
||||
rel_path_from_pods_root_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(Pod::Config.instance.installation_root)
|
||||
rel_path_from_pods_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(File.join(Pod::Config.instance.installation_root, 'Pods'))
|
||||
|
||||
|
||||
s.script_phases = {
|
||||
:name => "Generate Legacy Components Interop",
|
||||
:script => "
|
||||
s.script_phases = {
|
||||
:name => "Generate Legacy Components Interop",
|
||||
:script => "
|
||||
WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
|
||||
source $WITH_ENVIRONMENT
|
||||
${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{rel_path_from_pods_to_app} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
|
||||
",
|
||||
:execution_position => :before_compile,
|
||||
:input_files => ["#{rel_path_from_pods_root_to_app}/react-native.config.js"],
|
||||
:output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
|
||||
}
|
||||
end
|
||||
",
|
||||
:execution_position => :before_compile,
|
||||
:input_files => ["#{rel_path_from_pods_root_to_app}/react-native.config.js"],
|
||||
:output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
|
||||
}
|
||||
end
|
||||
|
||||
@@ -93,25 +93,6 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
# ========================== #
|
||||
# Test - GetReactCodegenSpec #
|
||||
# ========================== #
|
||||
|
||||
def testGetReactCodegenSpec_whenFabricDisabledAndNoScriptPhases_generatesAPodspec
|
||||
# Arrange
|
||||
FileMock.files_to_read('package.json' => '{ "version": "99.98.97"}')
|
||||
|
||||
# Act
|
||||
podspec = CodegenUtils.new().get_react_codegen_spec(
|
||||
'package.json',
|
||||
:fabric_enabled => false,
|
||||
:hermes_enabled => true,
|
||||
:script_phases => nil,
|
||||
:file_manager => FileMock
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert_equal(podspec, get_podspec_no_fabric_no_script())
|
||||
assert_equal(Pod::UI.collected_messages, [])
|
||||
end
|
||||
|
||||
def testGetReactCodegenSpec_whenFabricEnabledAndScriptPhases_generatesAPodspec
|
||||
# Arrange
|
||||
FileMock.files_to_read('package.json' => '{ "version": "99.98.97"}')
|
||||
@@ -119,7 +100,6 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
# Act
|
||||
podspec = CodegenUtils.new().get_react_codegen_spec(
|
||||
'package.json',
|
||||
:fabric_enabled => true,
|
||||
:hermes_enabled => true,
|
||||
:script_phases => "echo Test Script Phase",
|
||||
:file_manager => FileMock
|
||||
@@ -138,7 +118,7 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
# Act
|
||||
podspec = CodegenUtils.new().get_react_codegen_spec(
|
||||
'package.json',
|
||||
:fabric_enabled => true,
|
||||
|
||||
:hermes_enabled => true,
|
||||
:script_phases => nil,
|
||||
:file_manager => FileMock
|
||||
@@ -380,11 +360,9 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||
:app_path => app_path,
|
||||
:config_file_dir => "",
|
||||
:config_key => "codegenConfig",
|
||||
:fabric_enabled => false,
|
||||
:react_native_path => "../node_modules/react-native"}
|
||||
])
|
||||
assert_equal(codegen_utils_mock.get_react_codegen_spec_params, [{
|
||||
:fabric_enabled => false,
|
||||
:folly_version=>"2023.08.07.00",
|
||||
:package_json_file => "#{app_path}/ios/../node_modules/react-native/package.json",
|
||||
:script_phases => "echo TestScript"
|
||||
|
||||
@@ -58,7 +58,6 @@ class CodegenUtilsMock
|
||||
)
|
||||
@get_react_codegen_script_phases_params.push({
|
||||
app_path: app_path,
|
||||
fabric_enabled: fabric_enabled,
|
||||
config_file_dir: config_file_dir,
|
||||
react_native_path: react_native_path,
|
||||
config_key: config_key
|
||||
@@ -66,11 +65,10 @@ class CodegenUtilsMock
|
||||
return @react_codegen_script_phases
|
||||
end
|
||||
|
||||
def get_react_codegen_spec(package_json_file, folly_version: '2023.08.07.00', fabric_enabled: false, hermes_enabled: true, script_phases: nil)
|
||||
def get_react_codegen_spec(package_json_file, folly_version: '2023.08.07.00', hermes_enabled: true, script_phases: nil)
|
||||
@get_react_codegen_spec_params.push({
|
||||
package_json_file: package_json_file,
|
||||
folly_version: folly_version,
|
||||
fabric_enabled: fabric_enabled,
|
||||
script_phases: script_phases
|
||||
})
|
||||
return @react_codegen_spec
|
||||
|
||||
@@ -66,11 +66,10 @@ class CodegenUtils
|
||||
#
|
||||
# Parameters
|
||||
# - package_json_file: the path to the `package.json`, required to extract the proper React Native version
|
||||
# - fabric_enabled: whether fabric is enabled or not.
|
||||
# - hermes_enabled: whether hermes is enabled or not.
|
||||
# - script_phases: whether we want to add some build script phases or not.
|
||||
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
||||
def get_react_codegen_spec(package_json_file, folly_version: '2023.08.07.00', fabric_enabled: false, hermes_enabled: true, script_phases: nil, file_manager: File)
|
||||
def get_react_codegen_spec(package_json_file, folly_version: '2023.08.07.00', hermes_enabled: true, script_phases: nil, file_manager: File)
|
||||
package = JSON.parse(file_manager.read(package_json_file))
|
||||
version = package['version']
|
||||
new_arch_disabled = ENV['RCT_NEW_ARCH_ENABLED'] != "1"
|
||||
@@ -136,18 +135,13 @@ class CodegenUtils
|
||||
"React-NativeModulesApple": [],
|
||||
"glog": [],
|
||||
"DoubleConversion": [],
|
||||
}
|
||||
}
|
||||
|
||||
if fabric_enabled
|
||||
spec[:'dependencies'].merge!({
|
||||
'React-graphics': [],
|
||||
'React-rendererdebug': [],
|
||||
'React-Fabric': [],
|
||||
'React-debug': [],
|
||||
'React-utils': [],
|
||||
});
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
if hermes_enabled
|
||||
spec[:'dependencies'].merge!({
|
||||
@@ -313,7 +307,6 @@ class CodegenUtils
|
||||
react_codegen_spec = codegen_utils.get_react_codegen_spec(
|
||||
file_manager.join(relative_installation_root, react_native_path, "package.json"),
|
||||
:folly_version => folly_version,
|
||||
:fabric_enabled => fabric_enabled,
|
||||
:hermes_enabled => hermes_enabled,
|
||||
:script_phases => script_phases
|
||||
)
|
||||
|
||||
@@ -103,6 +103,8 @@ def use_react_native! (
|
||||
|
||||
ReactNativePodsUtils.warn_if_not_on_arm64()
|
||||
|
||||
build_codegen!(prefix, relative_path_from_current)
|
||||
|
||||
# The Pods which should be included in all projects
|
||||
pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
|
||||
pod 'RCTRequired', :path => "#{prefix}/Libraries/Required"
|
||||
@@ -174,15 +176,7 @@ def use_react_native! (
|
||||
# If the New Arch is turned off, we will use the Old Renderer, though.
|
||||
# RNTester always installed Fabric, this change is required to make the template work.
|
||||
setup_fabric!(:react_native_path => prefix)
|
||||
|
||||
if !fabric_enabled
|
||||
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
||||
build_codegen!(prefix, relative_installation_root)
|
||||
end
|
||||
|
||||
if NewArchitectureHelper.new_arch_enabled
|
||||
setup_bridgeless!(:react_native_path => prefix, :use_hermes => hermes_enabled)
|
||||
end
|
||||
setup_bridgeless!(:react_native_path => prefix, :use_hermes => hermes_enabled)
|
||||
|
||||
pods_to_update = LocalPodspecPatch.pods_to_update(:react_native_path => prefix)
|
||||
if !pods_to_update.empty?
|
||||
|
||||
Reference in New Issue
Block a user