diff options
author | Jorge Canizales <jcanizales@google.com> | 2016-06-08 14:51:41 -0700 |
---|---|---|
committer | Jorge Canizales <jcanizales@google.com> | 2016-06-08 19:21:58 -0700 |
commit | 2f46326213a466b24137b60d9a8660cb07ccfe31 (patch) | |
tree | c887922ab93e8ecbb55870efe7b476fb439a417b /src/objective-c/tests/Podfile | |
parent | eb71417df91abe8515f522b242003630e664e7df (diff) |
Pre-install hook in the Tests podspec for local dev of gRPC-Core
Diffstat (limited to 'src/objective-c/tests/Podfile')
-rw-r--r-- | src/objective-c/tests/Podfile | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index f36c60c997..41814f18af 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -26,4 +26,36 @@ GRPC_LOCAL_SRC = '../../..' end end +# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's +# pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded +# and before they are installed in the user project. +# +# This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where +# Cocoapods normally places the downloaded sources. When doing local development of the libraries, +# though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and +# doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the +# symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those +# aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly +# to point at the local directory where the sources are. +# +# TODO(jcanizales): Send a PR to Cocoapods to get rid of this need. +pre_install do |installer| + # This is the gRPC-Core podspec object, as initialized by its podspec file. + grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec + + # Copied from gRPC-Core.podspec, except for the adjusted src_root: + + src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" + + public_build_settings = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + } + private_build_settings = public_build_settings.merge({ + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + }) + grpc_core_spec.user_target_xcconfig = public_build_settings + grpc_core_spec.pod_target_xcconfig = private_build_settings end |