Skip to content

Commit

Permalink
Restore Dynamic framework with Hermes in the Old Architecture
Browse files Browse the repository at this point in the history
Summary:
I discovered that 0.69 could run React Native as Dynamic framework with Hermes and starting from 0.70 that's not possible anymore.
This diff restore that possibility.

Notice that now Hermes provisdes JSI and Dynamic Frameworks requires that all the dependencies are explicitly defined, therefore, whenever we have a pod that depended on `React-jsi`, now it also has to explicitly depends on `hermes-engine`

## Changelog
[iOS][Fixed] - Add Back dynamic framework support for the Old Architecture with Hermes

Reviewed By: cortinico

Differential Revision: D42829728

fbshipit-source-id: a660e3b1e346ec6cf3ceb8771dd8bceb0dbcb13a
  • Loading branch information
cipolleschi authored and kelset committed Jan 30, 2023
1 parent 4d3e7f8 commit 5f536be
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Libraries/Blob/React-RCTBlob.podspec
Expand Up @@ -45,4 +45,8 @@ Pod::Spec.new do |s|
s.dependency "React-Core/RCTBlobHeaders", version
s.dependency "React-Core/RCTWebSocket", version
s.dependency "React-RCTNetwork", version

if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
s.dependency "hermes-engine"
end
end
23 changes: 17 additions & 6 deletions React-Core.podspec
Expand Up @@ -75,12 +75,20 @@ Pod::Spec.new do |s|

s.subspec "Default" do |ss|
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
ss.exclude_files = "React/CoreModules/**/*",
"React/DevSupport/**/*",
"React/Fabric/**/*",
"React/FBReactNativeSpec/**/*",
"React/Tests/**/*",
"React/Inspector/**/*"
exclude_files = [
"React/CoreModules/**/*",
"React/DevSupport/**/*",
"React/Fabric/**/*",
"React/FBReactNativeSpec/**/*",
"React/Tests/**/*",
"React/Inspector/**/*"
]
# If we are using Hermes (the default is use hermes, so USE_HERMES can be nil), we don't have jsc installed
# So we have to exclude the JSCExecutorFactory
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
end
ss.exclude_files = exclude_files
ss.private_header_files = "React/Cxx*/*.h"
end

Expand Down Expand Up @@ -117,5 +125,8 @@ Pod::Spec.new do |s|

if ENV['USE_HERMES'] == "0"
s.dependency 'React-jsc'
else
s.dependency 'React-hermes'
s.dependency 'hermes-engine'
end
end
8 changes: 7 additions & 1 deletion ReactCommon/ReactCommon.podspec
Expand Up @@ -19,7 +19,7 @@ end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
folly_version = '2021.07.22.00'
boost_compiler_flags = '-Wno-documentation'

using_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
Pod::Spec.new do |s|
s.name = "ReactCommon"
s.module_name = "ReactCommon"
Expand Down Expand Up @@ -49,13 +49,19 @@ Pod::Spec.new do |s|
s.dependency "React-logger", version
ss.dependency "DoubleConversion"
ss.dependency "glog"
if using_hermes
ss.dependency "hermes-engine"
end

ss.subspec "bridging" do |sss|
sss.dependency "React-jsi", version
sss.source_files = "react/bridging/**/*.{cpp,h}"
sss.exclude_files = "react/bridging/tests"
sss.header_dir = "react/bridging"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
if using_hermes
sss.dependency "hermes-engine"
end
end

ss.subspec "core" do |sss|
Expand Down
4 changes: 4 additions & 0 deletions ReactCommon/cxxreact/React-cxxreact.podspec
Expand Up @@ -46,4 +46,8 @@ Pod::Spec.new do |s|
s.dependency "React-perflogger", version
s.dependency "React-jsi", version
s.dependency "React-logger", version

if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
s.dependency 'hermes-engine'
end
end
1 change: 1 addition & 0 deletions ReactCommon/hermes/React-hermes.podspec
Expand Up @@ -52,4 +52,5 @@ Pod::Spec.new do |s|
s.dependency "glog"
s.dependency "RCT-Folly/Futures", folly_version
s.dependency "hermes-engine"
s.dependency "React-jsi"
end
4 changes: 4 additions & 0 deletions ReactCommon/jsiexecutor/React-jsiexecutor.podspec
Expand Up @@ -40,4 +40,8 @@ Pod::Spec.new do |s|
s.dependency "RCT-Folly", folly_version
s.dependency "DoubleConversion"
s.dependency "glog"

if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
s.dependency 'hermes-engine'
end
end

0 comments on commit 5f536be

Please sign in to comment.