|
|
|
@ -69,24 +69,14 @@ Pod::Spec.new do |s| |
|
|
|
|
s.module_map = 'include/grpc/module.modulemap' |
|
|
|
|
|
|
|
|
|
# To compile the library, we need the user headers search path (quoted includes) to point to the |
|
|
|
|
# root of the repo, and the system headers search path (angled includes) to point to `include/`. |
|
|
|
|
# Cocoapods effectively clones the repo under `<Podfile dir>/Pods/gRPC-Core/`, and sets a build |
|
|
|
|
# variable called `$(PODS_ROOT)` to `<Podfile dir>/Pods/`, so we use that. |
|
|
|
|
# |
|
|
|
|
# Relying on the file structure under $(PODS_ROOT) isn't officially supported in Cocoapods, as it |
|
|
|
|
# is taken as an implementation detail. We've asked for an alternative, and have been told that |
|
|
|
|
# what we're doing should keep working: https://github.com/CocoaPods/CocoaPods/issues/4386 |
|
|
|
|
# |
|
|
|
|
# The `src_root` value of `$(PODS_ROOT)/gRPC-Core` assumes Cocoapods is installing this pod from |
|
|
|
|
# its remote repo. For local development of this library, enabled by using `:path` in the Podfile, |
|
|
|
|
# that assumption is wrong. In such case, the following settings need to be reset with the |
|
|
|
|
# appropriate value of `src_root`. This can be accomplished in the `pre_install` hook of the |
|
|
|
|
# Podfile; see `src/objective-c/tests/Podfile` for an example. |
|
|
|
|
src_root = '$(PODS_ROOT)/gRPC-Core' |
|
|
|
|
# root of the repo, third_party/** and two upb generated directories, and the system headers |
|
|
|
|
# search path (angled includes) to point to `include/`. |
|
|
|
|
s.pod_target_xcconfig = { |
|
|
|
|
'GRPC_SRC_ROOT' => src_root, |
|
|
|
|
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', |
|
|
|
|
'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', |
|
|
|
|
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_TARGET_SRCROOT)/include"', |
|
|
|
|
'USER_HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)"'\ |
|
|
|
|
' "$(PODS_TARGET_SRCROOT)/src/core/ext/upb-generated"'\ |
|
|
|
|
' "$(PODS_TARGET_SRCROOT)/src/core/ext/upbdefs-generated"'\ |
|
|
|
|
' "$(PODS_TARGET_SRCROOT)/third_party/**"', |
|
|
|
|
# If we don't set these two settings, `include/grpc/support/time.h` and |
|
|
|
|
# `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the |
|
|
|
|
# build. |
|
|
|
@ -2277,22 +2267,13 @@ Pod::Spec.new do |s| |
|
|
|
|
'test/core/util/trickle_endpoint.h' |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path? |
|
|
|
|
# patch include of openssl to openssl_grpc |
|
|
|
|
# patch xxhash.h to silent the -Wdocumentation error |
|
|
|
|
s.prepare_command = <<-END_OF_COMMAND |
|
|
|
|
set -e |
|
|
|
|
find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/(.*)>;#if COCOAPODS==1\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g' |
|
|
|
|
find src/core -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <uv.h>;#if COCOAPODS==1\\\n #include <uv/uv.h>\\\n#else\\\n #include <uv.h>\\\n#endif;g' |
|
|
|
|
find third_party/upb/ -type f \\( -name '*.h' -or -name '*.hpp' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "third_party/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/third_party/\\1"\\\n#else\\\n #include "third_party/\\1"\\\n#endif;g' |
|
|
|
|
find src/core/ src/cpp/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.hpp' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/upb/\\1"\\\n#else\\\n #include "upb/\\1"\\\n#endif;g' |
|
|
|
|
find src/core/ src/cpp/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm |
|
|
|
|
find src/core/ src/cpp/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g' |
|
|
|
|
find src/core/ src/cpp/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upbdefs.h";#if COCOAPODS==1\\\n #include "src/core/ext/upbdefs-generated/\\1.upbdefs.h"\\\n#else\\\n #include "\\1.upbdefs.h"\\\n#endif;g' |
|
|
|
|
find src/core/ src/cpp/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm |
|
|
|
|
find third_party/re2/re2/ third_party/re2/util/ -type f \\( -name '*.h' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "re2/(.*)";#if COCOAPODS==1\\\n #include "third_party/re2/re2/\\1"\\\n#else\\\n #include "re2/\\1"\\\n#endif;g;s;#include "util/(.*)";#if COCOAPODS==1\\\n #include "third_party/re2/util/\\1"\\\n#else\\\n #include "util/\\1"\\\n#endif;g' |
|
|
|
|
find src/core/ -type f \\( -name '*.h' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "re2/(.*)";#if COCOAPODS==1\\\n #include "third_party/re2/re2/\\1"\\\n#else\\\n #include "re2/\\1"\\\n#endif;g' |
|
|
|
|
find src/core/ third_party/re2/ -type f -name '*.grpc_back' -print0 | xargs -0 rm |
|
|
|
|
find src/core/ -type f \\( -name '*.h' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "xxhash.h";#if COCOAPODS==1\\\n #include "third_party/xxhash/xxhash.h"\\\n#else\\\n #include "xxhash.h"\\\n#endif;g' |
|
|
|
|
find third_party/xxhash -type f -name xxhash.h -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;@param([^,]*),;@param\\1 ,;g' |
|
|
|
|
find src/core/ third_party/xxhash/ -type f -name '*.grpc_back' -print0 | xargs -0 rm |
|
|
|
|
find src/core/ third_party/xxhash/ third_party/uv/ -type f -name '*.grpc_back' -print0 | xargs -0 rm |
|
|
|
|
END_OF_COMMAND |
|
|
|
|
end |
|
|
|
|