Skip to content

Commit ce68600

Browse files
Riccardo Cipolleschimeta-codesync[bot]
authored andcommitted
Remove RCT_HERMES_V1_ENABLED from CocoaPods infrastructure (#56735)
Summary: Pull Request resolved: #56735 - Remove `RCT_HERMES_V1_ENABLED` environment variable from `react_native_pods.rb` - Simplify `jsengine.rb` to always use `.hermesversion` tag file - Remove conditional `HERMES_V1_ENABLED=1` preprocessor definition from `utils.rb` - Simplify `hermes-engine.podspec`: always read `HERMES_VERSION_NAME`, use V1 source files, remove legacy inspector subspecs - Simplify `hermes-utils.rb`: remove `hermes_v1_enabled()` function, always use `250829098.0.0-stable` branch, always use `.hermesversion` tag file ## Changelog: [iOS][Removed] - Remove the RCT_HERMES_V1_ENABLED from Cocoapods ## Test plan - [x] iOS: `bundle exec pod install` — success - [x] iOS: `xcodebuild` rn-tester on iPhone 16 Pro simulator — BUILD SUCCEEDED Differential Revision: D104247277 Reviewed By: cortinico
1 parent 994091e commit ce68600

5 files changed

Lines changed: 12 additions & 51 deletions

File tree

packages/react-native/scripts/cocoapods/jsengine.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def setup_hermes!(react_native_path: "../node_modules/react-native")
1313
react_native_dir = Pod::Config.instance.installation_root.join(react_native_path)
1414
# This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
1515
# We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
16-
hermestag_file_name = ENV['RCT_HERMES_V1_ENABLED'] == "1" ? ".hermesv1version" : ".hermesversion"
16+
hermestag_file_name = ".hermesv1version"
1717
hermestag_file = File.join(react_native_dir, "sdks", hermestag_file_name)
1818
hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
1919
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ def self.has_pod(installer, name)
4545
end
4646

4747
def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
48-
if ENV['RCT_HERMES_V1_ENABLED'] == "1"
49-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug)
50-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug)
51-
else
52-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
53-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
54-
end
48+
# HERMES_V1_ENABLED=1 is set unconditionally to stay aligned with the Android/CMake build,
49+
# where react-native-flags.cmake always defines HERMES_V1_ENABLED=1.
50+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug)
51+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug)
5552

5653
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
5754
end

packages/react-native/scripts/react_native_pods.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ def use_react_native! (
9595
# excluding the legacy arch unless the user turns this flag off explicitly.
9696
ENV['RCT_REMOVE_LEGACY_ARCH'] = ENV['RCT_REMOVE_LEGACY_ARCH'] == '0' ? '0' : '1'
9797

98-
# Enable Hermes V1 by default.
99-
# Users can still turn it off and use legacy hermes by setting the RCT_HERMES_V1_ENABLED
100-
# environment variable to '0'.
101-
ENV['RCT_HERMES_V1_ENABLED']= ENV['RCT_HERMES_V1_ENABLED'] == '0' ? '0' : '1'
102-
10398
ReactNativePodsUtils.check_minimum_required_xcode()
10499

100+
# Enable Hermes V1 by default. Keep the env var setup for backward compatibility.
101+
ENV['RCT_HERMES_V1_ENABLED'] = '1'
102+
105103
# Current target definition is provided by Cocoapods and it refers to the target
106104
# that has invoked the `use_react_native!` function.
107105
ReactNativePodsUtils.detect_use_frameworks(current_target_definition)

packages/react-native/sdks/hermes-engine/hermes-engine.podspec

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,7 @@ Pod::Spec.new do |spec|
5656

5757
spec.subspec 'Pre-built' do |ss|
5858
ss.preserve_paths = ["destroot/bin/*"].concat(["**/*.{h,c,cpp}"])
59-
if ENV["RCT_HERMES_V1_ENABLED"] == "0"
60-
ss.source_files = "destroot/include/hermes/**/*.h"
61-
else
62-
# Hermes v1 is shipping a jsi/hermes.h header which is imported by the hermes.h header
63-
# and that file is not present in React Native's JSI
64-
# (see https://github.com/facebook/react-native/tree/main/packages/react-native/ReactCommon/jsi/jsi/ where there is
65-
# hermes-interface.h but not hermes.h)
66-
ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"]
67-
end
59+
ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"]
6860
ss.header_mappings_dir = "destroot/include"
6961
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
7062
ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
@@ -127,20 +119,6 @@ Pod::Spec.new do |spec|
127119
ss.header_dir = 'hermes/Public'
128120
end
129121

130-
if ENV['RCT_HERMES_V1_ENABLED'] == "0"
131-
spec.subspec 'inspector' do |ss|
132-
ss.source_files = ''
133-
ss.public_header_files = 'API/hermes/inspector/*.h'
134-
ss.header_dir = 'hermes/inspector'
135-
end
136-
137-
spec.subspec 'inspector_chrome' do |ss|
138-
ss.source_files = ''
139-
ss.public_header_files = 'API/hermes/inspector/chrome/*.h'
140-
ss.header_dir = 'hermes/inspector/chrome'
141-
end
142-
end
143-
144122
hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc"
145123

146124
if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then

packages/react-native/sdks/hermes-engine/hermes-utils.rb

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ def hermes_commit_envvar_defined()
8585
return ENV.has_key?('HERMES_COMMIT')
8686
end
8787

88-
def hermes_v1_enabled()
89-
return ENV['RCT_HERMES_V1_ENABLED'] != "0"
90-
end
91-
9288
def force_build_from_tag(react_native_path)
9389
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
9490
end
@@ -175,16 +171,12 @@ def podspec_source_build_from_github_commit()
175171
def podspec_source_build_from_github_tag(react_native_path)
176172
tag = File.read(hermestag_file(react_native_path)).strip
177173

178-
if hermes_v1_enabled()
179-
hermes_log("Using tag defined in sdks/.hermesv1version: #{tag}")
180-
else
181-
hermes_log("Using tag defined in sdks/.hermesversion: #{tag}")
182-
end
174+
hermes_log("Using tag defined in sdks/.hermesv1version: #{tag}")
183175
return {:git => HERMES_GITHUB_URL, :tag => tag}
184176
end
185177

186178
def podspec_source_build_from_github_main()
187-
branch = hermes_v1_enabled() ? "250829098.0.0-stable" : "main"
179+
branch = "250829098.0.0-stable"
188180
hermes_log("Using the latest commit from #{branch}.")
189181
return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} #{branch} | cut -f 1`.strip}
190182
end
@@ -210,11 +202,7 @@ def artifacts_dir()
210202
end
211203

212204
def hermestag_file(react_native_path)
213-
if hermes_v1_enabled()
214-
return File.join(react_native_path, "sdks", ".hermesv1version")
215-
else
216-
return File.join(react_native_path, "sdks", ".hermesversion")
217-
end
205+
return File.join(react_native_path, "sdks", ".hermesv1version")
218206
end
219207

220208
def release_tarball_url(version, build_type)

0 commit comments

Comments
 (0)