From 33e22486e9d69e8a8754b253ad46b63415f19c76 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 30 May 2017 11:10:20 -0700 Subject: [PATCH] Fix some issues with the React podspec for the Cxx bridge Summary: Trying to fix the RN Travis CI tests Splitting off from https://github.com/facebook/react-native/pull/14100 Closes https://github.com/facebook/react-native/pull/14132 Reviewed By: ericvicenti Differential Revision: D5112077 Pulled By: javache fbshipit-source-id: cf030b927b0f28f2b494471498f1ddb2c0a5c1df --- React.podspec | 11 ++++++----- React/CxxBridge/RCTCxxBridge.mm | 7 +++++-- scripts/ios-configure-glog.sh | 10 ++++++++++ third-party-podspecs/Folly.podspec | 3 ++- third-party-podspecs/GLog.podspec | 14 +++++--------- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/React.podspec b/React.podspec index 4b00f90fc..b493b13a2 100644 --- a/React.podspec +++ b/React.podspec @@ -38,7 +38,7 @@ Pod::Spec.new do |s| s.requires_arc = true s.platform = :ios, "8.0" s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" } - s.preserve_paths = "package.json", "LICENSE", "LICENSE-CustomComponents", "PATENTS" + s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs", "PATENTS" s.cocoapods_version = ">= 1.2.0" s.subspec "Core" do |ss| @@ -47,6 +47,7 @@ Pod::Spec.new do |s| 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++" + ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } end s.subspec "BatchedBridge" do |ss| @@ -56,7 +57,7 @@ Pod::Spec.new do |s| end s.subspec "CxxBridge" do |ss| - ss.dependency "Folly" + ss.dependency "Folly", "2016.09.26.00" ss.dependency "React/Core" ss.dependency "React/cxxreact" ss.compiler_flags = folly_compiler_flags @@ -90,7 +91,7 @@ Pod::Spec.new do |s| end s.subspec "jschelpers" do |ss| - ss.dependency "Folly" + ss.dependency "Folly", "2016.09.26.00" ss.compiler_flags = folly_compiler_flags ss.source_files = "ReactCommon/jschelpers/*.{cpp,h}" ss.private_header_files = "ReactCommon/jschelpers/*.h" @@ -101,10 +102,10 @@ Pod::Spec.new do |s| s.subspec "cxxreact" do |ss| ss.dependency "React/jschelpers" ss.dependency "boost" - ss.dependency "Folly" + ss.dependency "Folly", "2016.09.26.00" ss.compiler_flags = folly_compiler_flags ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}" - ss.exclude_files = "ReactCommon/cxxreact/JSCTracing.cpp" + ss.exclude_files = "ReactCommon/cxxreact/{JSCTracing,SampleCxxModule}.*" 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 diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index e1db3bdf2..41d04bf10 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -20,7 +20,6 @@ #import #import #import -#import #import #import #import @@ -47,6 +46,10 @@ #import #endif +#if RCT_DEV && __has_include("RCTDevLoadingView.h") +#import "RCTDevLoadingView.h" +#endif + @interface RCTCxxBridge : RCTBridge @end @@ -333,7 +336,7 @@ struct RCTInstanceCallback : public InstanceCallback { sourceCode = source; dispatch_group_leave(prepareBridge); } onProgress:^(RCTLoadingProgress *progressData) { -#ifdef RCT_DEV +#if RCT_DEV && __has_include("RCTDevLoadingView.h") RCTDevLoadingView *loadingView = [weakSelf moduleForClass:[RCTDevLoadingView class]]; [loadingView updateProgress:progressData]; #endif diff --git a/scripts/ios-configure-glog.sh b/scripts/ios-configure-glog.sh index 1aadbfdff..92b7f31d1 100755 --- a/scripts/ios-configure-glog.sh +++ b/scripts/ios-configure-glog.sh @@ -4,6 +4,7 @@ set -e # Only set when not running in an Xcode context if [ -z "$ACTION" ] || [ -z "$BUILD_DIR" ]; then export CC="$(xcrun -find -sdk iphoneos cc) -arch armv7 -isysroot $(xcrun -sdk iphoneos --show-sdk-path)" + export CXX="$CC" fi ./configure --host arm-apple-darwin @@ -23,4 +24,13 @@ cat << EOF >> src/config.h #undef HAVE_SYS_SYSCALL_H #undef OS_MACOSX #endif + +/* Special configuration for ucontext */ +#undef HAVE_UCONTEXT_H +#undef PC_FROM_UCONTEXT +#if defined(__x86_64__) +#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip +#elif defined(__i386__) +#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip +#endif EOF diff --git a/third-party-podspecs/Folly.podspec b/third-party-podspecs/Folly.podspec index d514f9d2a..19dc9765e 100644 --- a/third-party-podspecs/Folly.podspec +++ b/third-party-podspecs/Folly.podspec @@ -17,12 +17,13 @@ Pod::Spec.new do |spec| '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.libraries = "stdc++" spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\"" } # Pinning to the same version as React.podspec. diff --git a/third-party-podspecs/GLog.podspec b/third-party-podspecs/GLog.podspec index 795f2ee56..f0db33335 100644 --- a/third-party-podspecs/GLog.podspec +++ b/third-party-podspecs/GLog.podspec @@ -6,13 +6,7 @@ Pod::Spec.new do |spec| 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.prepare_command = File.read("../scripts/ios-configure-glog.sh") spec.source = { :git => 'https://github.com/google/glog.git', :tag => "v#{spec.version}" } spec.module_name = 'glog' @@ -24,11 +18,13 @@ Pod::Spec.new do |spec| 'src/symbolize.cc', 'src/utilities.cc', 'src/vlog_is_on.cc' - spec.public_header_files = 'src/glog/*.h' + spec.exclude_files = "src/windows/**/*" + spec.public_header_files = "src/glog/*.h" + spec.libraries = "stdc++" 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' + spec.platform = :ios, "8.0" end