Remove RCT_HERMES_V1_ENABLED from CocoaPods infrastructure (#56735)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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

Reviewed By: cortinico

Differential Revision: D104247277

fbshipit-source-id: ba61c29f3471c3894c3690ac80f83038f0436b70
This commit is contained in:
Riccardo Cipolleschi authored and meta-codesync[bot] committed 2026-05-11 12:55:12 -07:00
1 parent 0a5c8c6b4b
commit 940ee8ae0d
5 files changed
+12 -51

No files matched your search

@@ -13,7 +13,7 @@ def setup_hermes!(react_native_path: "../node_modules/react-native")
react_native_dir = Pod::Config.instance.installation_root.join(react_native_path)
# This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
# We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
hermestag_file_name = ENV['RCT_HERMES_V1_ENABLED'] == "1" ? ".hermesv1version" : ".hermesversion"
hermestag_file_name = ".hermesv1version"
hermestag_file = File.join(react_native_dir, "sdks", hermestag_file_name)
hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
@@ -45,13 +45,10 @@ class ReactNativePodsUtils
end
def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
if ENV['RCT_HERMES_V1_ENABLED'] == "1"
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug)
else
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
end
# HERMES_V1_ENABLED=1 is set unconditionally to stay aligned with the Android/CMake build,
# where react-native-flags.cmake always defines HERMES_V1_ENABLED=1.
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
end
@@ -95,13 +95,11 @@ def use_react_native! (
# excluding the legacy arch unless the user turns this flag off explicitly.
ENV['RCT_REMOVE_LEGACY_ARCH'] = ENV['RCT_REMOVE_LEGACY_ARCH'] == '0' ? '0' : '1'
# Enable Hermes V1 by default.
# Users can still turn it off and use legacy hermes by setting the RCT_HERMES_V1_ENABLED
# environment variable to '0'.
ENV['RCT_HERMES_V1_ENABLED']= ENV['RCT_HERMES_V1_ENABLED'] == '0' ? '0' : '1'
ReactNativePodsUtils.check_minimum_required_xcode()
# Enable Hermes V1 by default. Keep the env var setup for backward compatibility.
ENV['RCT_HERMES_V1_ENABLED'] = '1'
# Current target definition is provided by Cocoapods and it refers to the target
# that has invoked the `use_react_native!` function.
ReactNativePodsUtils.detect_use_frameworks(current_target_definition)
@@ -56,15 +56,7 @@ Pod::Spec.new do |spec|
spec.subspec 'Pre-built' do |ss|
ss.preserve_paths = ["destroot/bin/*"].concat(["**/*.{h,c,cpp}"])
if ENV["RCT_HERMES_V1_ENABLED"] == "0"
ss.source_files = "destroot/include/hermes/**/*.h"
else
# Hermes v1 is shipping a jsi/hermes.h header which is imported by the hermes.h header
# and that file is not present in React Native's JSI
# (see https://github.com/facebook/react-native/tree/main/packages/react-native/ReactCommon/jsi/jsi/ where there is
# hermes-interface.h but not hermes.h)
ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"]
end
ss.source_files = ["destroot/include/hermes/**/*.h", "destroot/include/jsi/hermes.h"]
ss.header_mappings_dir = "destroot/include"
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
@@ -127,20 +119,6 @@ Pod::Spec.new do |spec|
ss.header_dir = 'hermes/Public'
end
if ENV['RCT_HERMES_V1_ENABLED'] == "0"
spec.subspec 'inspector' do |ss|
ss.source_files = ''
ss.public_header_files = 'API/hermes/inspector/*.h'
ss.header_dir = 'hermes/inspector'
end
spec.subspec 'inspector_chrome' do |ss|
ss.source_files = ''
ss.public_header_files = 'API/hermes/inspector/chrome/*.h'
ss.header_dir = 'hermes/inspector/chrome'
end
end
hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc"
if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then
@@ -85,10 +85,6 @@ def hermes_commit_envvar_defined()
return ENV.has_key?('HERMES_COMMIT')
end
def hermes_v1_enabled()
return ENV['RCT_HERMES_V1_ENABLED'] != "0"
end
def force_build_from_tag(react_native_path)
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
end
@@ -175,16 +171,12 @@ end
def podspec_source_build_from_github_tag(react_native_path)
tag = File.read(hermestag_file(react_native_path)).strip
if hermes_v1_enabled()
hermes_log("Using tag defined in sdks/.hermesv1version: #{tag}")
else
hermes_log("Using tag defined in sdks/.hermesversion: #{tag}")
end
hermes_log("Using tag defined in sdks/.hermesv1version: #{tag}")
return {:git => HERMES_GITHUB_URL, :tag => tag}
end
def podspec_source_build_from_github_main()
branch = hermes_v1_enabled() ? "250829098.0.0-stable" : "main"
branch = "250829098.0.0-stable"
hermes_log("Using the latest commit from #{branch}.")
return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} #{branch} | cut -f 1`.strip}
end
@@ -210,11 +202,7 @@ def artifacts_dir()
end
def hermestag_file(react_native_path)
if hermes_v1_enabled()
return File.join(react_native_path, "sdks", ".hermesv1version")
else
return File.join(react_native_path, "sdks", ".hermesversion")
end
return File.join(react_native_path, "sdks", ".hermesv1version")
end
def release_tarball_url(version, build_type)