Skip to content

Commit 8de71e5

Browse files
dmytrorykunkelset
authored andcommitted
Make sure that hermes-engine is updated with cocoapods. (#37148)
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
1 parent 34d7d01 commit 8de71e5

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def test_setupHermes_whenHermesScriptSucceeds_installsPods
105105
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
106106
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
107107
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
108-
assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
108+
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
109+
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
110+
assert_equal(hermes_engine_pod_invocation[:tag], "")
109111
end
110112

111113
def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
@@ -118,7 +120,9 @@ def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
118120
# Assert
119121
assert_equal($podInvocationCount, 4)
120122
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
121-
assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
123+
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
124+
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
125+
assert_equal(hermes_engine_pod_invocation[:tag], "")
122126
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
123127
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
124128
end

packages/react-native/scripts/cocoapods/__tests__/test_utils/podSpy.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ def podSpy_cleanUp
2626
$podInvocationCount = 0
2727
end
2828

29-
def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil)
29+
def pod(name, version = nil, path: nil, configurations: nil, modular_headers: nil, podspec: nil, tag: nil)
3030
$podInvocationCount += 1
3131
params = {}
3232
if version != nil then params[:version] = version end
3333
if path != nil then params[:path] = path end
3434
if configurations != nil then params[:configurations] = configurations end
3535
if modular_headers != nil then params[:modular_headers] = modular_headers end
3636
if podspec != nil then params[:podspec] = podspec end
37+
if tag != nil then params[:tag] = tag end
3738
$podInvocation[name] = params
3839
end

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ def setup_hermes!(react_native_path: "../node_modules/react-native", fabric_enab
3030
abort unless prep_status == 0
3131

3232
pod 'React-jsi', :path => "#{react_native_path}/ReactCommon/jsi"
33-
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes/hermes-engine.podspec"
33+
# This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
34+
# We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
35+
hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
36+
hermestag = File.exist?(hermestag_file) ? File.read().strip : ''
37+
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
3438
pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
3539
pod 'libevent', '~> 2.1.12'
3640
end

0 commit comments

Comments
 (0)