Skip to content

Commit 9e591ac

Browse files
Kudofortmarek
authored andcommitted
Fix broken use_frameworks from React-bridging (#34011)
Summary: `use_frameworks!` is broken again in react-native 0.69 because React-bridging. in the `use_frameworks!` mode, header structures are flattened, so `#include <react/bridging/CallbackWrapper.h>` is not reachable to the header. to somehow workaround the issue without touch React-bridging imports, the pr do these things: - use `header_mappings_dir` to keep `react/bridging` header structure - because the header structure is not default framework header structure, explicitly `HEADER_SEARCH_PATHS` is necessary. - forward declare `CallbackWrapper` and use it internally in ReactCommon. so that we don't need to add `HEADER_SEARCH_PATHS` for React-bridging to every pods depending on `ReactCommon/turbomodule/core`, e.g. React-RCTSettings.podspec. [iOS] [Fixed] - Fix use_frameworks! for 0.69 Pull Request resolved: #34011 Test Plan: ```sh $ npx react-native init RN069 --version next $ yarn ios ``` Reviewed By: cortinico, cipolleschi Differential Revision: D37169699 Pulled By: dmitryrykun fbshipit-source-id: 309c55f1c611a2fc3902a83e8af814daaf2af6a0
1 parent 9d3ce32 commit 9e591ac

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

ReactCommon/react/bridging/React-bridging.podspec renamed to ReactCommon/React-bridging.podspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
require "json"
77

8-
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
8+
package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
99
version = package['version']
1010

1111
source = { :git => 'https://github.com/facebook/react-native.git' }
@@ -28,9 +28,10 @@ Pod::Spec.new do |s|
2828
s.author = "Facebook, Inc. and its affiliates"
2929
s.platforms = { :ios => "12.4" }
3030
s.source = source
31-
s.source_files = "**/*.{cpp,h}"
32-
s.exclude_files = "tests"
31+
s.source_files = "react/bridging/**/*.{cpp,h}"
32+
s.exclude_files = "react/bridging/tests"
3333
s.header_dir = "react/bridging"
34+
s.header_mappings_dir = "."
3435
s.compiler_flags = folly_compiler_flags
3536
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",
3637
"USE_HEADERMAP" => "YES",

ReactCommon/ReactCommon.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
3232
s.source = source
3333
s.header_dir = "ReactCommon" # Use global header_dir for all subspecs for use_frameworks! compatibility
3434
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
35-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/React-bridging\"",
35+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers\"",
3636
"USE_HEADERMAP" => "YES",
3737
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
3838

ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#import <React/RCTModuleMethod.h>
1717
#import <ReactCommon/CallInvoker.h>
1818
#import <ReactCommon/TurboModule.h>
19-
#import <ReactCommon/TurboModuleUtils.h>
2019
#import <string>
2120
#import <unordered_map>
2221

@@ -27,6 +26,7 @@
2726
namespace facebook {
2827
namespace react {
2928

29+
class CallbackWrapper;
3030
class Instance;
3131

3232
typedef std::weak_ptr<CallbackWrapper> (

ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#import <ReactCommon/TurboCxxModule.h>
2828
#import <ReactCommon/TurboModuleBinding.h>
2929
#import <ReactCommon/TurboModulePerfLogger.h>
30+
#import <ReactCommon/TurboModuleUtils.h>
3031

3132
using namespace facebook;
3233
using namespace facebook::react;

scripts/react_native_pods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def use_react_native! (options={})
6565
pod 'React-Core/DevSupport', :path => "#{prefix}/"
6666
end
6767

68-
pod 'React-bridging', :path => "#{prefix}/ReactCommon/react/bridging"
68+
pod 'React-bridging', :path => "#{prefix}/ReactCommon"
6969
pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact"
7070
pod 'React-jsi', :path => "#{prefix}/ReactCommon/jsi"
7171
pod 'React-jsiexecutor', :path => "#{prefix}/ReactCommon/jsiexecutor"

0 commit comments

Comments
 (0)