Skip to content

Commit 0959ff3

Browse files
janicduplessisfacebook-github-bot
authored andcommitted
Move hermes to a separate podspec (#30478)
Summary: Hermes being a subspec of ReactCore causes some build issues when RN is included in 2 different targets. It also causes it to include a lot of additional dependencies that it doesn't need. This moves it to a separate podspec loosely based on other specs in ReactCommon. ## Changelog [iOS] [Fixed] - Move hermes to a separate podspec Pull Request resolved: #30478 Test Plan: Test that it builds and run properly in an app Reviewed By: fkgozali Differential Revision: D25308237 Pulled By: hramos fbshipit-source-id: b4cc44ea2b1b854831e881dbbf9a2f30f6704001
1 parent 5d8fcde commit 0959ff3

File tree

5 files changed

+56
-14
lines changed

5 files changed

+56
-14
lines changed

React-Core.podspec

-11
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@ Pod::Spec.new do |s|
6262
ss.private_header_files = "React/Cxx*/*.h"
6363
end
6464

65-
s.subspec "Hermes" do |ss|
66-
ss.platforms = { :osx => "10.14", :ios => "10.0" }
67-
ss.source_files = "ReactCommon/hermes/executor/*.{cpp,h}",
68-
"ReactCommon/hermes/inspector/*.{cpp,h}",
69-
"ReactCommon/hermes/inspector/chrome/*.{cpp,h}",
70-
"ReactCommon/hermes/inspector/detail/*.{cpp,h}"
71-
ss.pod_target_xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" }
72-
ss.dependency "RCT-Folly/Futures"
73-
ss.dependency "hermes-engine"
74-
end
75-
7665
s.subspec "DevSupport" do |ss|
7766
ss.source_files = "React/DevSupport/*.{h,mm,m}",
7867
"React/Inspector/*.{h,mm,m}"

React/CxxBridge/RCTCxxBridge.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#endif
4747

4848
#if RCT_USE_HERMES
49-
#import "HermesExecutorFactory.h"
49+
#import <reacthermes/HermesExecutorFactory.h">
5050
#else
5151
#import "JSCExecutorFactory.h"
5252
#endif
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
require "json"
7+
8+
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9+
version = package['version']
10+
11+
source = { :git => 'https://github.com/facebook/react-native.git' }
12+
if version == '1000.0.0'
13+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14+
source[:commit] = `git rev-parse HEAD`.strip
15+
else
16+
source[:tag] = "v#{version}"
17+
end
18+
19+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
20+
folly_version = '2020.01.13.00'
21+
boost_compiler_flags = '-Wno-documentation'
22+
23+
Pod::Spec.new do |s|
24+
s.name = "React-hermes"
25+
s.version = version
26+
s.summary = "-" # TODO
27+
s.homepage = "https://reactnative.dev/"
28+
s.license = package["license"]
29+
s.author = "Facebook, Inc. and its affiliates"
30+
s.platforms = { :osx => "10.14", :ios => "10.0" }
31+
s.source = source
32+
s.source_files = "executor/*.{cpp,h}",
33+
"inspector/*.{cpp,h}",
34+
"inspector/chrome/*.{cpp,h}",
35+
"inspector/detail/*.{cpp,h}"
36+
s.public_header_files = "executor/HermesExecutorFactory.h"
37+
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
38+
s.pod_target_xcconfig = {
39+
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
40+
"GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1",
41+
}
42+
s.header_dir = "reacthermes"
43+
s.dependency "React-cxxreact", version
44+
s.dependency "React-jsi", version
45+
s.dependency "React-jsiexecutor", version
46+
s.dependency "React-jsinspector", version
47+
s.dependency "React-perflogger", version
48+
s.dependency "RCT-Folly", folly_version
49+
s.dependency "RCT-Folly/Futures", folly_version
50+
s.dependency "DoubleConversion"
51+
s.dependency "glog"
52+
s.dependency "hermes-engine"
53+
end

packages/rn-tester/RNTester/AppDelegate.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#endif
1717

1818
#if RCT_USE_HERMES
19-
#import <React/HermesExecutorFactory.h>
19+
#import <reacthermes/HermesExecutorFactory.h>
2020
#else
2121
#import <React/JSCExecutorFactory.h>
2222
#endif

scripts/react_native_pods.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def use_react_native! (options={})
6262
end
6363

6464
if hermes_enabled
65-
pod 'React-Core/Hermes', :path => "#{prefix}/"
65+
pod 'React-hermes', :path => "#{prefix}/ReactCommon/hermes"
6666
pod 'hermes-engine'
6767
pod 'libevent', :podspec => "#{prefix}/third-party-podspecs/libevent.podspec"
6868
end

0 commit comments

Comments
 (0)