From f3f44eee59e8991e197c854e5fee719105c045cd Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Thu, 15 Jun 2017 12:47:42 -0700 Subject: [PATCH] Work around the broken way CocoaPods/Xcode deals with header maps Summary: See https://github.com/facebook/react-native/issues/14326 for the bug this fixes. This is a pretty ugly hack to work around what I think is a CP bug. Since the C++ dependencies are only needed to build RN itself, and not applications, don't the conflicting headers as source files. Instead, use preserve_paths to get them unpacked into the source tree under Pods/, and arrange for them to get used with HEADER_SEARCH_PATHS. This keeps them out of the project, so they don't get included in the header map, and other (badly structured) projects don't get confused. Reviewed By: javache Differential Revision: D5254716 fbshipit-source-id: cf33dcbcc71b5247843650c33ccf4fb08378e584 --- React.podspec | 2 +- third-party-podspecs/Folly.podspec | 5 +++-- third-party-podspecs/GLog.podspec | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/React.podspec b/React.podspec index b493b13a2..337eff3ba 100644 --- a/React.podspec +++ b/React.podspec @@ -107,7 +107,7 @@ Pod::Spec.new do |s| ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}" 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\"" } + ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\"" } end s.subspec "ART" do |ss| diff --git a/third-party-podspecs/Folly.podspec b/third-party-podspecs/Folly.podspec index 19dc9765e..d68dcd056 100644 --- a/third-party-podspecs/Folly.podspec +++ b/third-party-podspecs/Folly.podspec @@ -13,14 +13,15 @@ Pod::Spec.new do |spec| 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', + spec.source_files = 'folly/Bits.cpp', 'folly/Conv.cpp', 'folly/Demangle.cpp', 'folly/StringBase.cpp', 'folly/Unicode.cpp', 'folly/dynamic.cpp', 'folly/json.cpp' + # workaround for https://github.com/facebook/react-native/issues/14326 + spec.preserve_paths = 'folly/*.h' spec.libraries = "stdc++" spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", diff --git a/third-party-podspecs/GLog.podspec b/third-party-podspecs/GLog.podspec index f0db33335..0f402a846 100644 --- a/third-party-podspecs/GLog.podspec +++ b/third-party-podspecs/GLog.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |spec| spec.source = { :git => 'https://github.com/google/glog.git', :tag => "v#{spec.version}" } spec.module_name = 'glog' - spec.source_files = 'src/**/*.h', + spec.source_files = 'src/glog/*.h', 'src/demangle.cc', 'src/logging.cc', 'src/raw_logging.cc', @@ -18,8 +18,10 @@ Pod::Spec.new do |spec| 'src/symbolize.cc', 'src/utilities.cc', 'src/vlog_is_on.cc' + # workaround for https://github.com/facebook/react-native/issues/14326 + spec.preserve_paths = 'src/*.h', + 'src/base/*.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" }