From 5aca739cc25949eebc04a0309c2944f92b5b5391 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Wed, 3 May 2017 14:31:35 -0700 Subject: [PATCH] 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 --- React.podspec | 46 +++++++++++++++++-- third-party-podspecs/DoubleConversion.podspec | 17 +++++++ third-party-podspecs/Folly.podspec | 43 +++++++++++++++++ third-party-podspecs/GLog.podspec | 34 ++++++++++++++ 4 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 third-party-podspecs/DoubleConversion.podspec create mode 100644 third-party-podspecs/Folly.podspec create mode 100644 third-party-podspecs/GLog.podspec diff --git a/React.podspec b/React.podspec index 71384be54364c3..336b43a6e10137 100644 --- a/React.podspec +++ b/React.podspec @@ -11,6 +11,8 @@ else source[:tag] = "v#{version}" end +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1' + Pod::Spec.new do |s| s.name = "React" s.version = version @@ -41,13 +43,27 @@ Pod::Spec.new do |s| s.subspec "Core" do |ss| ss.dependency "Yoga", "#{package["version"]}.React" - ss.dependency "React/cxxreact" ss.source_files = "React/**/*.{c,h,m,mm,S}" - ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*" + ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*", "React/Base/RCTBatchedBridge.mm", "React/Executors/*" ss.framework = "JavaScriptCore" ss.libraries = "stdc++" end + s.subspec "BatchedBridge" do |ss| + ss.dependency "React/Core" + ss.dependency "React/cxxreact_legacy" + ss.source_files = "React/Base/RCTBatchedBridge.mm", "React/Executors/*" + end + + s.subspec "CxxBridge" do |ss| + ss.dependency "Folly" + ss.dependency "React/Core" + ss.dependency "React/cxxreact" + ss.compiler_flags = folly_compiler_flags + ss.private_header_files = "React/Cxx*/*.h" + ss.source_files = "React/Cxx*/*.{h,m,mm}" + end + s.subspec "DevSupport" do |ss| ss.dependency "React/Core" ss.dependency "React/RCTWebSocket" @@ -59,20 +75,40 @@ Pod::Spec.new do |s| ss.source_files = "React/**/RCTTVView.{h, m}" end - s.subspec "jschelpers" do |ss| + s.subspec "jschelpers_legacy" do |ss| ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}", "ReactCommon/jschelpers/systemJSCWrapper.cpp" ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.h" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } ss.framework = "JavaScriptCore" end - s.subspec "cxxreact" do |ss| - ss.dependency "React/jschelpers" + s.subspec "cxxreact_legacy" do |ss| + ss.dependency "React/jschelpers_legacy" ss.source_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.{cpp,h}" ss.private_header_files = "ReactCommon/cxxreact/{JSBundleType,oss-compat-util}.h" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } end + s.subspec "jschelpers" do |ss| + ss.dependency "Folly" + ss.compiler_flags = folly_compiler_flags + ss.source_files = "ReactCommon/jschelpers/*.{cpp,h}" + ss.private_header_files = "ReactCommon/jschelpers/*.h" + ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } + ss.framework = "JavaScriptCore" + end + + s.subspec "cxxreact" do |ss| + ss.dependency "React/jschelpers" + ss.dependency "boost" + ss.dependency "Folly" + ss.compiler_flags = folly_compiler_flags + ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}" + ss.exclude_files = "ReactCommon/cxxreact/JSCTracing.cpp" + ss.private_header_files = "ReactCommon/cxxreact/*.h" + ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\"" } + end + s.subspec "ART" do |ss| ss.dependency "React/Core" ss.source_files = "Libraries/ART/**/*.{h,m}" diff --git a/third-party-podspecs/DoubleConversion.podspec b/third-party-podspecs/DoubleConversion.podspec new file mode 100644 index 00000000000000..0c454f1ba67178 --- /dev/null +++ b/third-party-podspecs/DoubleConversion.podspec @@ -0,0 +1,17 @@ +Pod::Spec.new do |spec| + spec.name = 'DoubleConversion' + spec.version = '1.1.5' + spec.license = { :type => 'BSD' } + spec.homepage = 'https://github.com/google/double-conversion' + spec.summary = 'Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles' + spec.authors = 'Google' + spec.prepare_command = 'mv src double-conversion' + spec.source = { :git => 'https://github.com/google/double-conversion.git', + :tag => "v#{spec.version}" } + spec.module_name = 'DoubleConversion' + spec.source_files = 'double-conversion/*.{h,cc}' + + # Pinning to the same version as React.podspec. + spec.platform = :ios, '8.0' + +end diff --git a/third-party-podspecs/Folly.podspec b/third-party-podspecs/Folly.podspec new file mode 100644 index 00000000000000..d514f9d2a0622f --- /dev/null +++ b/third-party-podspecs/Folly.podspec @@ -0,0 +1,43 @@ +Pod::Spec.new do |spec| + spec.name = 'Folly' + spec.version = '2016.09.26.00' + spec.license = { :type => 'Apache License, Version 2.0' } + spec.homepage = 'https://github.com/facebook/folly' + spec.summary = 'An open-source C++ library developed and used at Facebook.' + spec.authors = 'Facebook' + spec.source = { :git => 'https://github.com/facebook/folly.git', + :tag => "v#{spec.version}" } + spec.module_name = 'folly' + spec.dependency 'boost' + spec.dependency 'DoubleConversion' + spec.dependency 'GLog' + spec.compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1' + spec.header_mappings_dir = 'folly' + spec.source_files = 'folly/*.h', + 'folly/Bits.cpp', + 'folly/Conv.cpp', + 'folly/Demangle.cpp', +# 'folly/File.cpp', + 'folly/StringBase.cpp', + 'folly/Unicode.cpp', + 'folly/dynamic.cpp', + 'folly/json.cpp' + spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\"" } + + # Pinning to the same version as React.podspec. + spec.platform = :ios, '8.0' + + spec.subspec "detail" do |ss| + ss.header_dir = 'folly/detail' + ss.source_files = 'folly/detail/*.h', + 'folly/detail/MallocImpl.cpp' + end + + spec.subspec "portability" do |ss| + ss.header_dir = 'folly/portability' + ss.source_files = 'folly/portability/*.h', + 'folly/portability/BitsFunctexcept.cpp' + end + +end diff --git a/third-party-podspecs/GLog.podspec b/third-party-podspecs/GLog.podspec new file mode 100644 index 00000000000000..795f2ee5630445 --- /dev/null +++ b/third-party-podspecs/GLog.podspec @@ -0,0 +1,34 @@ +Pod::Spec.new do |spec| + spec.name = 'GLog' + spec.version = '0.3.4' + spec.license = { :type => 'Google', :file => 'COPYING' } + spec.homepage = 'https://github.com/google/glog' + spec.summary = 'Google logging module' + spec.authors = 'Google' + + spec.prepare_command = <<-CMD + echo '#!/bin/sh' > ./ios-cc.sh + echo 'exec "$(xcrun -find -sdk iphoneos cc)" -arch armv7 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path)" "$@"' >> ./ios-cc.sh + chmod 755 ./ios-cc.sh + CC="`pwd`"/ios-cc.sh CXX="`pwd`"/ios-cc.sh ./configure --host arm-apple-darwin + CMD + + spec.source = { :git => 'https://github.com/google/glog.git', + :tag => "v#{spec.version}" } + spec.module_name = 'glog' + spec.source_files = 'src/**/*.h', + 'src/demangle.cc', + 'src/logging.cc', + 'src/raw_logging.cc', + 'src/signalhandler.cc', + 'src/symbolize.cc', + 'src/utilities.cc', + 'src/vlog_is_on.cc' + spec.public_header_files = 'src/glog/*.h' + spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", + "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src" } + + # Pinning to the same version as React.podspec. + spec.platform = :ios, '8.0' + +end