Skip to content

Commit 5aeb99e

Browse files
hramosfacebook-github-bot
authored andcommitted
CocoaPods: Do not configure Hermes search paths if Hermes is disabled
Summary: The React-Hermes and hermes-engine headers are only needed when Hermes is enabled. Changelog: [internal] Reviewed By: cipolleschi Differential Revision: D40451162 fbshipit-source-id: d38830f8abe57a91798e216d7930bb7add483899
1 parent 6b129d8 commit 5aeb99e

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

Libraries/AppDelegate/React-RCTAppDelegate.podspec

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ new_arch_enabled_flag="RCT_NEW_ARCH_ENABLED"
2323
is_new_arch_enabled = ENV[new_arch_enabled_flag] == "1"
2424
other_cflags = "$(inherited) -DRN_FABRIC_ENABLED " + folly_flags + (is_new_arch_enabled ? " -D"+"RCT_NEW_ARCH_ENABLED" : "")
2525

26+
use_hermes = ENV['USE_HERMES'] == '1'
27+
28+
header_search_paths = [
29+
"$(PODS_TARGET_SRCROOT)/ReactCommon",
30+
"$(PODS_ROOT)/Headers/Private/React-Core",
31+
"$(PODS_ROOT)/boost",
32+
"$(PODS_ROOT)/DoubleConversion",
33+
"$(PODS_ROOT)/RCT-Folly",
34+
"${PODS_ROOT}/Headers/Public/FlipperKit",
35+
"$(PODS_ROOT)/Headers/Public/ReactCommon",
36+
"$(PODS_ROOT)/Headers/Public/React-RCTFabric"
37+
].concat(use_hermes ? [
38+
"$(PODS_ROOT)/Headers/Public/React-hermes",
39+
"$(PODS_ROOT)/Headers/Public/hermes-engine"
40+
] : []).map{|p| "\"#{p}\""}.join(" ")
41+
2642
Pod::Spec.new do |s|
2743
s.name = "React-RCTAppDelegate"
2844
s.version = version
@@ -38,7 +54,7 @@ Pod::Spec.new do |s|
3854
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
3955
s.compiler_flags = other_cflags
4056
s.pod_target_xcconfig = {
41-
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"",
57+
"HEADER_SEARCH_PATHS" => header_search_paths,
4258
"OTHER_CPLUSPLUSFLAGS" => other_cflags,
4359
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
4460
}

React-Core.podspec

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
2020
folly_version = '2021.07.22.00'
2121
boost_compiler_flags = '-Wno-documentation'
2222

23+
use_hermes = ENV['USE_HERMES'] == '1'
24+
2325
header_subspecs = {
2426
'CoreModulesHeaders' => 'React/CoreModules/**/*.h',
2527
'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h',
@@ -34,6 +36,19 @@ header_subspecs = {
3436
'RCTVibrationHeaders' => 'Libraries/Vibration/*.h',
3537
}
3638

39+
header_search_paths = [
40+
"$(PODS_TARGET_SRCROOT)/ReactCommon",
41+
"$(PODS_ROOT)/boost",
42+
"$(PODS_ROOT)/DoubleConversion",
43+
"$(PODS_ROOT)/RCT-Folly",
44+
"${PODS_ROOT}/Headers/Public/FlipperKit",
45+
"$(PODS_ROOT)/Headers/Public/ReactCommon",
46+
"$(PODS_ROOT)/Headers/Public/React-RCTFabric"
47+
].concat(use_hermes ? [
48+
"$(PODS_ROOT)/Headers/Public/React-hermes",
49+
"$(PODS_ROOT)/Headers/Public/hermes-engine"
50+
] : []).map{|p| "\"#{p}\""}.join(" ")
51+
3752
Pod::Spec.new do |s|
3853
s.name = "React-Core"
3954
s.version = version
@@ -48,12 +63,13 @@ Pod::Spec.new do |s|
4863
s.header_dir = "React"
4964
s.framework = "JavaScriptCore"
5065
s.pod_target_xcconfig = {
51-
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"",
52-
"FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
53-
"DEFINES_MODULE" => "YES",
54-
"GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}",
55-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
56-
}
66+
"HEADER_SEARCH_PATHS" => header_search_paths,
67+
"DEFINES_MODULE" => "YES",
68+
"GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}",
69+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
70+
}.merge!(use_hermes ? {
71+
"FRAMEWORK_SEARCH_PATHS" => "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-hermes\""
72+
} : {})
5773
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
5874
s.default_subspec = "Default"
5975

scripts/react_native_pods.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def use_react_native! (
6767
# Better to rely and enable this environment flag if the new architecture is turned on using flags.
6868
ENV['RCT_NEW_ARCH_ENABLED'] = new_arch_enabled ? "1" : "0"
6969
fabric_enabled = fabric_enabled || new_arch_enabled
70+
ENV['USE_HERMES'] = hermes_enabled ? "1" : "0"
7071

7172
prefix = path
7273

0 commit comments

Comments
 (0)