Skip to content

Commit 22875fe

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Remove the option to use JSC from core
Summary: This change simplified the setp disallowing to use JSC from core. As a side effect, it simplified the setup by always falling back to hermes if the users decides not to use the third party JSC ## Changelog: [iOS][Removed] - remove the option to use JSC from core Differential Revision: D76342625
1 parent 0954c1d commit 22875fe

File tree

20 files changed

+73
-163
lines changed

20 files changed

+73
-163
lines changed

packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ else
1717
end
1818

1919
is_new_arch_enabled = ENV["RCT_NEW_ARCH_ENABLED"] != "0"
20-
use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
21-
2220
new_arch_enabled_flag = (is_new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED=1" : "")
23-
hermes_flag = (use_hermes ? " -DUSE_HERMES=1" : "")
24-
use_third_party_jsc_flag = ENV['USE_THIRD_PARTY_JSC'] == '1' ? " -DUSE_THIRD_PARTY_JSC=1" : ""
25-
other_cflags = "$(inherited) " + new_arch_enabled_flag + hermes_flag + use_third_party_jsc_flag
21+
other_cflags = "$(inherited) " + new_arch_enabled_flag + js_engine_flags()
2622

2723
header_search_paths = [
2824
"$(PODS_TARGET_SRCROOT)/../../ReactCommon",
@@ -31,7 +27,7 @@ header_search_paths = [
3127
"$(PODS_ROOT)/Headers/Public/ReactCommon",
3228
"$(PODS_ROOT)/Headers/Public/React-RCTFabric",
3329
"$(PODS_ROOT)/Headers/Private/Yoga",
34-
].concat(use_hermes ? [
30+
].concat(use_hermes() ? [
3531
"$(PODS_ROOT)/Headers/Public/React-hermes",
3632
"$(PODS_ROOT)/Headers/Public/hermes-engine"
3733
] : [])
@@ -66,7 +62,7 @@ Pod::Spec.new do |s|
6662
s.dependency "React-CoreModules"
6763
s.dependency "React-RCTFBReactNativeSpec"
6864
s.dependency "React-defaultsnativemodule"
69-
if use_hermes
65+
if use_hermes()
7066
s.dependency 'React-hermes'
7167
end
7268

packages/react-native/Libraries/Blob/React-RCTBlob.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Pod::Spec.new do |s|
5050
add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp')
5151
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
5252

53-
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
53+
if use_hermes()
5454
s.dependency "hermes-engine"
5555
end
5656

packages/react-native/React-Core.podspec

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ else
1616
source[:tag] = "v#{version}"
1717
end
1818

19-
use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
20-
use_hermes_flag = use_hermes ? "-DUSE_HERMES=1" : ""
21-
use_third_party_jsc_flag = ENV['USE_THIRD_PARTY_JSC'] == '1' ? "-DUSE_THIRD_PARTY_JSC=1" : ""
22-
2319
header_subspecs = {
2420
'CoreModulesHeaders' => 'React/CoreModules/**/*.h',
2521
'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h',
@@ -35,7 +31,7 @@ header_subspecs = {
3531
}
3632

3733
frameworks_search_paths = []
38-
frameworks_search_paths << "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-hermes\"" if use_hermes
34+
frameworks_search_paths << "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-hermes\"" if use_hermes()
3935

4036
header_search_paths = [
4137
"$(PODS_TARGET_SRCROOT)/ReactCommon",
@@ -56,7 +52,7 @@ Pod::Spec.new do |s|
5652
s.platforms = min_supported_versions
5753
s.source = source
5854
s.resource_bundle = { "RCTI18nStrings" => ["React/I18n/strings/*.lproj"]}
59-
s.compiler_flags = use_hermes_flag + ' ' + use_third_party_jsc_flag
55+
s.compiler_flags = js_engine_flags()
6056
s.header_dir = "React"
6157
s.weak_framework = "JavaScriptCore"
6258
s.pod_target_xcconfig = {
@@ -80,13 +76,9 @@ Pod::Spec.new do |s|
8076
"React/Inspector/**/*",
8177
"React/Runtime/**/*",
8278
]
83-
# If we are using Hermes (the default is use hermes, so USE_HERMES can be nil), we don't have jsc installed
84-
# So we have to exclude the JSCExecutorFactory
85-
if use_hermes
86-
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
87-
elsif ENV['USE_THIRD_PARTY_JSC'] == '1'
88-
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
89-
end
79+
80+
# The default is use hermes, we don't have jsc installed
81+
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
9082

9183
ss.exclude_files = exclude_files
9284
ss.private_header_files = "React/Cxx*/*.h"
@@ -123,7 +115,7 @@ Pod::Spec.new do |s|
123115
s.dependency "React-runtimescheduler"
124116
s.dependency "Yoga"
125117

126-
if use_hermes
118+
if use_hermes()
127119
s.dependency "React-hermes"
128120
end
129121

@@ -136,7 +128,6 @@ Pod::Spec.new do |s|
136128
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
137129
add_dependency(s, "RCTDeprecation")
138130

139-
140131
depend_on_js_engine(s)
141132
add_rn_third_party_dependencies(s)
142133
end

packages/react-native/React/Runtime/React-RCTRuntime.podspec

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ Pod::Spec.new do |s|
5858
add_dependency(s, "React-RuntimeCore")
5959
add_dependency(s, "React-RuntimeApple")
6060

61-
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
61+
if use_third_party_jsc()
62+
s.exclude_files = ["RCTHermesInstanceFactory.{mm,h}", "RCTJscInstanceFactory.{mm,h}"]
63+
else
6264
s.dependency "hermes-engine"
6365
add_dependency(s, "React-RuntimeHermes")
6466
s.exclude_files = "RCTJscInstanceFactory.{h,mm}"
65-
elsif ENV['USE_THIRD_PARTY_JSC'] == '1'
66-
s.exclude_files = ["RCTHermesInstanceFactory.{mm,h}", "RCTJscInstanceFactory.{mm,h}"]
67-
else
68-
s.exclude_files = ["RCTHermesInstanceFactory.{mm,h}"]
6967
end
68+
7069
depend_on_js_engine(s)
7170
add_rn_third_party_dependencies(s)
7271
end

packages/react-native/ReactCommon/ReactCommon.podspec

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ else
1616
source[:tag] = "v#{version}"
1717
end
1818

19-
using_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
20-
2119
Pod::Spec.new do |s|
2220
s.name = "ReactCommon"
2321
s.module_name = "ReactCommon"
@@ -48,7 +46,7 @@ Pod::Spec.new do |s|
4846
ss.dependency "React-cxxreact", version
4947
ss.dependency "React-jsi", version
5048
ss.dependency "React-logger", version
51-
if using_hermes
49+
if use_hermes()
5250
ss.dependency "hermes-engine"
5351
end
5452

@@ -58,7 +56,7 @@ Pod::Spec.new do |s|
5856
sss.exclude_files = "react/bridging/tests"
5957
sss.header_dir = "react/bridging"
6058
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
61-
if using_hermes
59+
if use_hermes()
6260
sss.dependency "hermes-engine"
6361
end
6462
end

packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Pod::Spec.new do |s|
4848

4949
s.resource_bundles = {'React-cxxreact_privacy' => 'PrivacyInfo.xcprivacy'}
5050

51-
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
51+
if use_hermes()
5252
s.dependency 'hermes-engine'
5353
end
5454

packages/react-native/ReactCommon/jserrorhandler/React-jserrorhandler.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Pod::Spec.new do |s|
4444
add_dependency(s, "React-featureflags")
4545
add_dependency(s, "React-debug")
4646

47-
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
47+
if use_hermes()
4848
s.dependency 'hermes-engine'
4949
end
5050

packages/react-native/ReactCommon/jsi/React-jsi.podspec

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
require "json"
77

8-
js_engine = ENV['USE_HERMES'] == "0" ?
9-
:jsc :
10-
:hermes
11-
128
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
139
version = package['version']
1410

@@ -42,7 +38,7 @@ Pod::Spec.new do |s|
4238
"jsi/jsilib-windows.cpp",
4339
"**/test/*"
4440
]
45-
if js_engine == :hermes
41+
if use_hermes()
4642
# JSI is a part of hermes-engine. Including them also in react-native will violate the One Definition Rulle.
4743
files_to_exclude += [ "jsi/jsi.cpp" ]
4844
s.dependency "hermes-engine"

packages/react-native/ReactCommon/jsiexecutor/React-jsiexecutor.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
3636
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')
3737
add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp')
3838
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
39-
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
39+
if use_hermes()
4040
s.dependency 'hermes-engine'
4141
end
4242

packages/react-native/ReactCommon/jsinspector-modern/React-jsinspector.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Pod::Spec.new do |s|
5555
add_dependency(s, "React-jsinspectornetwork", :framework_name => 'jsinspector_modernnetwork')
5656
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
5757
s.dependency "React-perflogger", version
58-
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
58+
if use_hermes()
5959
s.dependency "hermes-engine"
6060
end
6161

0 commit comments

Comments
 (0)