Skip to content

Commit

Permalink
Make sure that hermes-engine is updated with cocoapods. (#37148)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37148

This should fix https://github.com/facebook/react-native/issue/36945, which is also causing annoyance when doing the releases

## Changelog:
[iOS][Changed] - Use contents of sdks/.hermesversion to let cocoapods recognize Hermes updates.

Reviewed By: cipolleschi

Differential Revision: D45394241

fbshipit-source-id: 972fbee8f954b90f7087bb232f922761c1639e06
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed May 2, 2023
1 parent 8494707 commit 9f496e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def test_setupHermes_whenHermesScriptSucceeds_installsPods
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
assert_equal(hermes_engine_pod_invocation[:tag], "")
end

def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
Expand All @@ -118,7 +120,9 @@ def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
# Assert
assert_equal($podInvocationCount, 4)
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
assert_equal(hermes_engine_pod_invocation[:tag], "")
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ def podSpy_cleanUp
$podInvocationCount = 0
end

def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil)
def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil, tag: nil)
$podInvocationCount += 1
params = {}
if version != nil then params[:version] = version end
if path != nil then params[:path] = path end
if configurations != nil then params[:configurations] = configurations end
if modular_headers != nil then params[:modular_headers] = modular_headers end
if podspec != nil then params[:podspec] = podspec end
if tag != nil then params[:tag] = tag end
$podInvocation[name] = params
end
6 changes: 5 additions & 1 deletion packages/react-native/scripts/cocoapods/jsengine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def setup_hermes!(react_native_path: "../node_modules/react-native", fabric_enab
abort unless prep_status == 0

pod 'React-jsi', :path => "#{react_native_path}/ReactCommon/jsi"
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes/hermes-engine.podspec"
# 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 = File.join(react_native_path, "sdks", ".hermesversion")
hermestag = File.exist?(hermestag_file) ? File.read().strip : ''
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
pod 'libevent', '~> 2.1.12'
end

0 comments on commit 9f496e2

Please sign in to comment.