Do not include two copies of JSI when using hermes-engine (#41499)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Dmitry Rykun
2023-11-16 03:05:35 -08:00
committed by Luna Wei
parent edb4746085
commit b23d71ca46
2 changed files with 9 additions and 3 deletions
@@ -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
@@ -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"