Skip to content

Commit

Permalink
Fix some issues with the React podspec for the Cxx bridge
Browse files Browse the repository at this point in the history
Summary:
Trying to fix the RN Travis CI tests

Splitting off from #14100
Closes #14132

Reviewed By: ericvicenti

Differential Revision: D5112077

Pulled By: javache

fbshipit-source-id: cf030b927b0f28f2b494471498f1ddb2c0a5c1df
  • Loading branch information
javache authored and facebook-github-bot committed May 30, 2017
1 parent 59e41b4 commit 33e2248
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
11 changes: 6 additions & 5 deletions React.podspec
Expand Up @@ -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|
Expand All @@ -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|
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions React/CxxBridge/RCTCxxBridge.mm
Expand Up @@ -20,7 +20,6 @@
#import <React/RCTConvert.h>
#import <React/RCTCxxModule.h>
#import <React/RCTCxxUtils.h>
#import <React/RCTDevLoadingView.h>
#import <React/RCTDevSettings.h>
#import <React/RCTDisplayLink.h>
#import <React/RCTJavaScriptLoader.h>
Expand All @@ -47,6 +46,10 @@
#import <React/RCTFBSystrace.h>
#endif

#if RCT_DEV && __has_include("RCTDevLoadingView.h")
#import "RCTDevLoadingView.h"
#endif

@interface RCTCxxBridge : RCTBridge
@end

Expand Down Expand Up @@ -333,7 +336,7 @@ - (void)start
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
Expand Down
10 changes: 10 additions & 0 deletions scripts/ios-configure-glog.sh
Expand Up @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion third-party-podspecs/Folly.podspec
Expand Up @@ -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.
Expand Down
14 changes: 5 additions & 9 deletions third-party-podspecs/GLog.podspec
Expand Up @@ -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'
Expand All @@ -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

1 comment on commit 33e2248

@ptomasroos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Eager to try it out

Please sign in to comment.