From eb34db031066e18e3e06602ac9fa1291db9cc8c8 Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Fri, 4 Mar 2022 18:58:14 +0800 Subject: [PATCH] Fix ios build error when podfile generate_multiple_pod_projects=true and fabric is on. --- React/React-RCTFabric.podspec | 2 +- ReactCommon/React-Fabric.podspec | 2 +- scripts/react_native_pods.rb | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index fb7c850c49ad2b..d6c5364190f276 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags s.header_dir = "React" s.framework = "JavaScriptCore" - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-Codegen\"" } + s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-Codegen\" \"$(PODS_ROOT)/Headers/Private/Yoga/yoga\"" } s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\"", "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags } diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index 096254395cc86c..18ef99e4218eb1 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -218,7 +218,7 @@ Pod::Spec.new do |s| sss.source_files = "react/renderer/components/view/**/*.{m,mm,cpp,h}" sss.exclude_files = "react/renderer/components/view/tests" sss.header_dir = "react/renderer/components/view" - sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } + sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/Yoga/yoga\"" } end end diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 74e2ab8a838c1c..c1c8b6c8824a9d 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -264,16 +264,15 @@ def modify_flags_for_new_architecture(installer, cpp_flags) config_file.save_as(xcconfig_path) end end - # Add RCT_NEW_ARCH_ENABLED to Pods project xcconfig - installer.pods_project.targets.each do |target| - # if target.name == 'React-Core' - if target.name == 'React-Core' - puts "#{target.name}" - target.build_configurations.each do |config| - config.build_settings['OTHER_CPLUSPLUSFLAGS'] = cpp_flags - end - end - end + + installer.target_installation_results.pod_target_installation_results + .each do |pod_name, target_installation_result| + if pod_name == 'React-Core' + target_installation_result.native_target.build_configurations.each do |config| + config.build_settings['OTHER_CPLUSPLUSFLAGS'] = cpp_flags + end + end + end end def build_codegen!(react_native_path) @@ -369,6 +368,7 @@ def get_react_codegen_spec(options={}) "\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"", "\"$(PODS_ROOT)/Headers/Private/React-Fabric\"", "\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"", + "\"$(PODS_ROOT)/Headers/Private/Yoga/yoga\"", ].join(' ') }, 'dependencies': {