Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-native/scripts/cocoapods/jsengine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ".hermesversion"
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
Expand Down
9 changes: 2 additions & 7 deletions packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,8 @@ def self.has_pod(installer, name)
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
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)

self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
end
Expand Down
5 changes: 0 additions & 5 deletions packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ 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()

# Current target definition is provided by Cocoapods and it refers to the target
Expand Down
39 changes: 2 additions & 37 deletions packages/react-native/sdks/hermes-engine/hermes-engine.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,7 @@ end
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
versionProperties = Hash[*File.read("version.properties").split(/[=\n]+/)]

if ENV['RCT_HERMES_V1_ENABLED'] == "0"
version = versionProperties['HERMES_VERSION_NAME']
else
version = versionProperties['HERMES_V1_VERSION_NAME']
end

# Local monorepo build
# We don't want to build Hermes V1 from source
if ENV['RCT_HERMES_V1_ENABLED'] == "0" && package['version'] == "1000.0.0" then
hermesCompilerVersion = package['dependencies']['hermes-compiler']
if hermesCompilerVersion != "0.0.0" then
version = hermesCompilerVersion
end
end
version = versionProperties['HERMES_VERSION_NAME']

source_type = hermes_source_type(version, react_native_path)
source = podspec_source(source_type, version, react_native_path)
Expand Down Expand Up @@ -69,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"
Expand Down Expand Up @@ -140,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
Expand Down
18 changes: 3 additions & 15 deletions packages/react-native/sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,16 +171,12 @@ def podspec_source_build_from_github_commit()
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/.hermesversion: #{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
Expand All @@ -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", ".hermesversion")
end

def release_tarball_url(version, build_type)
Expand Down
Loading