Skip to content

Commit

Permalink
Do not include two copies of JSI when using hermes-engine (#41499)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #41499

After D48152876 we consume JSI from `ReactCommon/jsi`, and ignore JSI that is distributed with `hermes-engine`.
This diff removes `include/jsi` from `source_files` of `hermes-engine` so we don't get two sets of JSI headers - one from `ReactCommon`, and the other one from `hermes-engine`.
This diff also fixes accidental breakage of ODR violation. We will no longer compile JSI into `react-native` when linking against `hermes-engine`, which already has JSI in it.
Changelog: [iOS][Fixed] - Exclude JSI headers when using hermes-engine prebuilt.

Reviewed By: cipolleschi

Differential Revision: D51347562

fbshipit-source-id: 6e4b9940c43d74d227a05999926b8752d7685670
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Nov 16, 2023
1 parent 3b68e39 commit 5029cef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/react-native/ReactCommon/jsi/React-jsi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ Pod::Spec.new do |s|
s.dependency "glog"

s.source_files = "**/*.{cpp,h}"
s.exclude_files = [
files_to_exclude = [
"jsi/jsilib-posix.cpp",
"jsi/jsilib-windows.cpp",
"**/test/*"
]
]
if js_engine == :hermes
# JSI is a part of hermes-engine. Including them also in react-native will violate the One Definition Rulle.
files_to_exclude += [ "jsi/jsi.cpp" ]
s.dependency "hermes-engine"
end
s.exclude_files = files_to_exclude
end
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Pod::Spec.new do |spec|

spec.subspec 'Pre-built' do |ss|
ss.preserve_paths = ["destroot/bin/*"].concat(["**/*.{h,c,cpp}"])
ss.source_files = "destroot/include/**/*.h"
ss.source_files = "destroot/include/hermes/**/*.h"
ss.header_mappings_dir = "destroot/include"
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
Expand Down

0 comments on commit 5029cef

Please sign in to comment.