Skip to content

Commit 5aca739

Browse files
mhorowitzfacebook-github-bot
authored andcommitted
BREAKING - Update podspecs to support and default to the C++ bridge
Summary: This will require people who use CocoaPods to update their Podfiles. You can see an example of a Podfile set up to use the Cxx bridge here: https://github.com/mhorowitz/native-navigation-boilerplate/blob/master/ios/Podfile If this doesn't work, you can continue to use the old bridge by adding a dependency of 'BatchedBridge' to the React subspecs in your Podfile, but this will stop working once the old bridge is removed. Reviewed By: javache Differential Revision: D4981920 fbshipit-source-id: 7c4f3bf1c3f9af3f934f03ec003a05d0cd3cb259
1 parent dd45e7e commit 5aca739

File tree

4 files changed

+135
-5
lines changed

4 files changed

+135
-5
lines changed

React.podspec

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ else
1111
source[:tag] = "v#{version}"
1212
end
1313

14+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
15+
1416
Pod::Spec.new do |s|
1517
s.name = "React"
1618
s.version = version
@@ -41,13 +43,27 @@ Pod::Spec.new do |s|
4143

4244
s.subspec "Core" do |ss|
4345
ss.dependency "Yoga", "#{package["version"]}.React"
44-
ss.dependency "React/cxxreact"
4546
ss.source_files = "React/**/*.{c,h,m,mm,S}"
46-
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*"
47+
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*", "React/Base/RCTBatchedBridge.mm", "React/Executors/*"
4748
ss.framework = "JavaScriptCore"
4849
ss.libraries = "stdc++"
4950
end
5051

52+
s.subspec "BatchedBridge" do |ss|
53+
ss.dependency "React/Core"
54+
ss.dependency "React/cxxreact_legacy"
55+
ss.source_files = "React/Base/RCTBatchedBridge.mm", "React/Executors/*"
56+
end
57+
58+
s.subspec "CxxBridge" do |ss|
59+
ss.dependency "Folly"
60+
ss.dependency "React/Core"
61+
ss.dependency "React/cxxreact"
62+
ss.compiler_flags = folly_compiler_flags
63+
ss.private_header_files = "React/Cxx*/*.h"
64+
ss.source_files = "React/Cxx*/*.{h,m,mm}"
65+
end
66+
5167
s.subspec "DevSupport" do |ss|
5268
ss.dependency "React/Core"
5369
ss.dependency "React/RCTWebSocket"
@@ -59,20 +75,40 @@ Pod::Spec.new do |s|
5975
ss.source_files = "React/**/RCTTVView.{h, m}"
6076
end
6177

62-
s.subspec "jschelpers" do |ss|
78+
s.subspec "jschelpers_legacy" do |ss|
6379
ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}", "ReactCommon/jschelpers/systemJSCWrapper.cpp"
6480
ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.h"
6581
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
6682
ss.framework = "JavaScriptCore"
6783
end
6884

69-
s.subspec "cxxreact" do |ss|
70-
ss.dependency "React/jschelpers"
85+
s.subspec "cxxreact_legacy" do |ss|
86+
ss.dependency "React/jschelpers_legacy"
7187
ss.source_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.{cpp,h}"
7288
ss.private_header_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.h"
7389
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
7490
end
7591

92+
s.subspec "jschelpers" do |ss|
93+
ss.dependency "Folly"
94+
ss.compiler_flags = folly_compiler_flags
95+
ss.source_files = "ReactCommon/jschelpers/*.{cpp,h}"
96+
ss.private_header_files = "ReactCommon/jschelpers/*.h"
97+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
98+
ss.framework = "JavaScriptCore"
99+
end
100+
101+
s.subspec "cxxreact" do |ss|
102+
ss.dependency "React/jschelpers"
103+
ss.dependency "boost"
104+
ss.dependency "Folly"
105+
ss.compiler_flags = folly_compiler_flags
106+
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
107+
ss.exclude_files = "ReactCommon/cxxreact/JSCTracing.cpp"
108+
ss.private_header_files = "ReactCommon/cxxreact/*.h"
109+
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\"" }
110+
end
111+
76112
s.subspec "ART" do |ss|
77113
ss.dependency "React/Core"
78114
ss.source_files = "Libraries/ART/**/*.{h,m}"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'DoubleConversion'
3+
spec.version = '1.1.5'
4+
spec.license = { :type => 'BSD' }
5+
spec.homepage = 'https://github.com/google/double-conversion'
6+
spec.summary = 'Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles'
7+
spec.authors = 'Google'
8+
spec.prepare_command = 'mv src double-conversion'
9+
spec.source = { :git => 'https://github.com/google/double-conversion.git',
10+
:tag => "v#{spec.version}" }
11+
spec.module_name = 'DoubleConversion'
12+
spec.source_files = 'double-conversion/*.{h,cc}'
13+
14+
# Pinning to the same version as React.podspec.
15+
spec.platform = :ios, '8.0'
16+
17+
end

third-party-podspecs/Folly.podspec

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'Folly'
3+
spec.version = '2016.09.26.00'
4+
spec.license = { :type => 'Apache License, Version 2.0' }
5+
spec.homepage = 'https://github.com/facebook/folly'
6+
spec.summary = 'An open-source C++ library developed and used at Facebook.'
7+
spec.authors = 'Facebook'
8+
spec.source = { :git => 'https://github.com/facebook/folly.git',
9+
:tag => "v#{spec.version}" }
10+
spec.module_name = 'folly'
11+
spec.dependency 'boost'
12+
spec.dependency 'DoubleConversion'
13+
spec.dependency 'GLog'
14+
spec.compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
15+
spec.header_mappings_dir = 'folly'
16+
spec.source_files = 'folly/*.h',
17+
'folly/Bits.cpp',
18+
'folly/Conv.cpp',
19+
'folly/Demangle.cpp',
20+
# 'folly/File.cpp',
21+
'folly/StringBase.cpp',
22+
'folly/Unicode.cpp',
23+
'folly/dynamic.cpp',
24+
'folly/json.cpp'
25+
spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
26+
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\"" }
27+
28+
# Pinning to the same version as React.podspec.
29+
spec.platform = :ios, '8.0'
30+
31+
spec.subspec "detail" do |ss|
32+
ss.header_dir = 'folly/detail'
33+
ss.source_files = 'folly/detail/*.h',
34+
'folly/detail/MallocImpl.cpp'
35+
end
36+
37+
spec.subspec "portability" do |ss|
38+
ss.header_dir = 'folly/portability'
39+
ss.source_files = 'folly/portability/*.h',
40+
'folly/portability/BitsFunctexcept.cpp'
41+
end
42+
43+
end

third-party-podspecs/GLog.podspec

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'GLog'
3+
spec.version = '0.3.4'
4+
spec.license = { :type => 'Google', :file => 'COPYING' }
5+
spec.homepage = 'https://github.com/google/glog'
6+
spec.summary = 'Google logging module'
7+
spec.authors = 'Google'
8+
9+
spec.prepare_command = <<-CMD
10+
echo '#!/bin/sh' > ./ios-cc.sh
11+
echo 'exec "$(xcrun -find -sdk iphoneos cc)" -arch armv7 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path)" "$@"' >> ./ios-cc.sh
12+
chmod 755 ./ios-cc.sh
13+
CC="`pwd`"/ios-cc.sh CXX="`pwd`"/ios-cc.sh ./configure --host arm-apple-darwin
14+
CMD
15+
16+
spec.source = { :git => 'https://github.com/google/glog.git',
17+
:tag => "v#{spec.version}" }
18+
spec.module_name = 'glog'
19+
spec.source_files = 'src/**/*.h',
20+
'src/demangle.cc',
21+
'src/logging.cc',
22+
'src/raw_logging.cc',
23+
'src/signalhandler.cc',
24+
'src/symbolize.cc',
25+
'src/utilities.cc',
26+
'src/vlog_is_on.cc'
27+
spec.public_header_files = 'src/glog/*.h'
28+
spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
29+
"HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src" }
30+
31+
# Pinning to the same version as React.podspec.
32+
spec.platform = :ios, '8.0'
33+
34+
end

0 commit comments

Comments
 (0)