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:

After #38922 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, which was first fixed here #35038
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.

Differential Revision: D51347562
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Nov 15, 2023
1 parent 7f52791 commit e7cd51c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions packages/react-native/ReactCommon/jsi/React-jsi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ Pod::Spec.new do |s|
s.dependency "glog"

s.source_files = "**/*.{cpp,h}"
s.exclude_files = [
"jsi/jsilib-posix.cpp",
"jsi/jsilib-windows.cpp",
"**/test/*"
]
exclude_files = [
"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.
exclude_files += [ "jsi/jsi.cpp" ]
end
s.exclude_files = exclude_files
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 e7cd51c

Please sign in to comment.