Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 1 | %YAML 1.2 |
| 2 | --- | |
Muxi Yan | 27e9db4 | 2017-01-30 09:21:05 -0800 | [diff] [blame] | 3 | # This file has been automatically generated from a template file. |
| 4 | # Please make modifications to `templates/gRPC-Core.podspec.template` |
| 5 | # instead. This file can be regenerated from the template by running |
| 6 | # `tools/buildgen/generate_projects.sh`. |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 7 | |
Muxi Yan | 27e9db4 | 2017-01-30 09:21:05 -0800 | [diff] [blame] | 8 | # gRPC Core CocoaPods podspec |
| 9 | # |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 10 | # Copyright 2015 gRPC authors. |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 11 | # |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 12 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 | # you may not use this file except in compliance with the License. |
| 14 | # You may obtain a copy of the License at |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 15 | # |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 16 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 17 | # |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 18 | # Unless required by applicable law or agreed to in writing, software |
| 19 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | # See the License for the specific language governing permissions and |
| 22 | # limitations under the License. |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 23 | |
| 24 | <%! |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 25 | def grpc_private_files(libs): |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 26 | out = [] |
| 27 | for lib in libs: |
| 28 | if lib.name in ("grpc", "gpr"): |
| 29 | out += lib.get('headers', []) |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 30 | out += lib.get('src', []) |
Muxi Yan | d89b9e3 | 2017-06-29 14:31:59 -0700 | [diff] [blame] | 31 | return [f for f in out if not f.startswith("third_party/nanopb/")] |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 32 | |
| 33 | def grpc_public_headers(libs): |
| 34 | out = [] |
| 35 | for lib in libs: |
| 36 | if lib.name in ("grpc", "gpr"): |
| 37 | out += lib.get('public_headers', []) |
| 38 | return out |
| 39 | |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 40 | def grpc_private_headers(libs): |
| 41 | out = [] |
| 42 | for lib in libs: |
| 43 | if lib.name in ("grpc", "gpr"): |
| 44 | out += lib.get('headers', []) |
Muxi Yan | d89b9e3 | 2017-06-29 14:31:59 -0700 | [diff] [blame] | 45 | return [f for f in out if not f.startswith("third_party/nanopb/")] |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 46 | |
| 47 | def ruby_multiline_list(files, indent): |
| 48 | return (',\n' + indent*' ').join('\'%s\'' % f for f in files) |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 49 | %> |
| 50 | Pod::Spec.new do |s| |
| 51 | s.name = 'gRPC-Core' |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 52 | version = '${settings.version}' |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 53 | s.version = version |
| 54 | s.summary = 'Core cross-platform gRPC library, written in C' |
| 55 | s.homepage = 'http://www.grpc.io' |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 56 | s.license = 'Apache License, Version 2.0' |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 57 | s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } |
| 58 | |
| 59 | s.source = { |
| 60 | :git => 'https://github.com/grpc/grpc.git', |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 61 | :tag => "v#{version}", |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Muxi Yan | 37d3fba | 2017-02-28 16:14:40 -0800 | [diff] [blame] | 64 | s.ios.deployment_target = '7.0' |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 65 | s.osx.deployment_target = '10.9' |
| 66 | s.requires_arc = false |
| 67 | |
| 68 | name = 'grpc' |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 69 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 70 | # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. |
| 71 | # This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include |
| 72 | # <gRPC-Core/grpc.h>`. |
| 73 | s.module_name = name |
| 74 | |
| 75 | # When creating a dynamic framework, copy the headers under `include/grpc/` into the root of |
| 76 | # the `Headers/` directory of the framework (i.e., not under `Headers/include/grpc`). |
| 77 | # |
| 78 | # TODO(jcanizales): Debug why this doesn't work on macOS. |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 79 | s.header_mappings_dir = 'include/grpc' |
| 80 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 81 | # The above has an undesired effect when creating a static library: It forces users to write |
| 82 | # includes like `#include <gRPC-Core/grpc.h>`. `s.header_dir` adds a path prefix to that, and |
| 83 | # because Cocoapods lets omit the pod name when including headers of static libraries, the |
| 84 | # following lets users write `#include <grpc/grpc.h>`. |
| 85 | s.header_dir = name |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 86 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 87 | # The module map created automatically by Cocoapods doesn't work for C libraries like gRPC-Core. |
Jorge Canizales | 3775074 | 2016-06-08 20:10:20 -0700 | [diff] [blame] | 88 | s.module_map = 'include/grpc/module.modulemap' |
| 89 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 90 | # To compile the library, we need the user headers search path (quoted includes) to point to the |
| 91 | # root of the repo, and the system headers search path (angled includes) to point to `include/`. |
| 92 | # Cocoapods effectively clones the repo under `<Podfile dir>/Pods/gRPC-Core/`, and sets a build |
| 93 | # variable called `$(PODS_ROOT)` to `<Podfile dir>/Pods/`, so we use that. |
| 94 | # |
| 95 | # Relying on the file structure under $(PODS_ROOT) isn't officially supported in Cocoapods, as it |
| 96 | # is taken as an implementation detail. We've asked for an alternative, and have been told that |
| 97 | # what we're doing should keep working: https://github.com/CocoaPods/CocoaPods/issues/4386 |
| 98 | # |
| 99 | # The `src_root` value of `$(PODS_ROOT)/gRPC-Core` assumes Cocoapods is installing this pod from |
| 100 | # its remote repo. For local development of this library, enabled by using `:path` in the Podfile, |
| 101 | # that assumption is wrong. In such case, the following settings need to be reset with the |
| 102 | # appropriate value of `src_root`. This can be accomplished in the `pre_install` hook of the |
| 103 | # Podfile; see `src/objective-c/tests/Podfile` for an example. |
| 104 | src_root = '$(PODS_ROOT)/gRPC-Core' |
| 105 | s.pod_target_xcconfig = { |
| 106 | 'GRPC_SRC_ROOT' => src_root, |
| 107 | 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', |
| 108 | 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', |
| 109 | # If we don't set these two settings, `include/grpc/support/time.h` and |
| 110 | # `src/core/lib/support/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the |
| 111 | # build. |
| 112 | 'USE_HEADERMAP' => 'NO', |
| 113 | 'ALWAYS_SEARCH_USER_PATHS' => 'NO', |
| 114 | } |
Jorge Canizales | 3775074 | 2016-06-08 20:10:20 -0700 | [diff] [blame] | 115 | |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 116 | s.default_subspecs = 'Interface', 'Implementation' |
Yuchen Zeng | 9e4c8eb | 2016-11-18 01:06:57 -0800 | [diff] [blame] | 117 | s.compiler_flags = '-DGRPC_ARES=0' |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 118 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 119 | # Like many other C libraries, gRPC-Core has its public headers under `include/<libname>/` and its |
| 120 | # sources and private headers in other directories outside `include/`. Cocoapods' linter doesn't |
| 121 | # allow any header to be listed outside the `header_mappings_dir` (even though doing so works in |
| 122 | # practice). Because we need our `header_mappings_dir` to be `include/grpc/` for the reason |
| 123 | # mentioned above, we work around the linter limitation by dividing the pod into two subspecs, one |
| 124 | # for public headers and the other for implementation. Each gets its own `header_mappings_dir`, |
| 125 | # making the linter happy. |
| 126 | # |
| 127 | # The list of source files is generated by a template: `templates/gRPC-Core.podspec.template`. It |
| 128 | # can be regenerated from the template by running `tools/buildgen/generate_projects.sh`. |
| 129 | s.subspec 'Interface' do |ss| |
| 130 | ss.header_mappings_dir = 'include/grpc' |
| 131 | |
| 132 | ss.source_files = ${ruby_multiline_list(grpc_public_headers(libs), 22)} |
| 133 | end |
| 134 | s.subspec 'Implementation' do |ss| |
| 135 | ss.header_mappings_dir = '.' |
| 136 | ss.libraries = 'z' |
| 137 | ss.dependency "#{s.name}/Interface", version |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 138 | ss.dependency 'BoringSSL', '~> 8.0' |
Muxi Yan | ad272c9 | 2017-06-29 16:18:43 -0700 | [diff] [blame^] | 139 | ss.dependency 'nanopb', '~> 0.3' |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 140 | |
| 141 | # To save you from scrolling, this is the last part of the podspec. |
| 142 | ss.source_files = ${ruby_multiline_list(grpc_private_files(libs), 22)} |
| 143 | |
| 144 | ss.private_header_files = ${ruby_multiline_list(grpc_private_headers(libs), 30)} |
| 145 | end |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 146 | |
| 147 | s.subspec 'Cronet-Interface' do |ss| |
| 148 | ss.header_mappings_dir = 'include/grpc' |
Muxi Yan | e38b012 | 2017-03-16 20:53:41 -0700 | [diff] [blame] | 149 | ss.source_files = 'include/grpc/grpc_cronet.h' |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 150 | end |
| 151 | |
Muxi Yan | f8372c6 | 2016-07-29 09:58:55 -0700 | [diff] [blame] | 152 | s.subspec 'Cronet-Implementation' do |ss| |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 153 | ss.header_mappings_dir = '.' |
Muxi Yan | e2de92f | 2017-01-31 16:30:52 -0800 | [diff] [blame] | 154 | |
| 155 | ss.dependency "#{s.name}/Interface", version |
| 156 | ss.dependency "#{s.name}/Implementation", version |
| 157 | ss.dependency "#{s.name}/Cronet-Interface", version |
| 158 | |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 159 | ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c', |
Muxi Yan | e38b012 | 2017-03-16 20:53:41 -0700 | [diff] [blame] | 160 | 'src/core/ext/transport/cronet/transport/cronet_transport.{c,h}', |
Muxi Yan | f0a1269 | 2017-01-31 16:36:56 -0800 | [diff] [blame] | 161 | 'third_party/objective_c/Cronet/bidirectional_stream_c.h' |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 162 | end |
| 163 | |
Muxi Yan | f8372c6 | 2016-07-29 09:58:55 -0700 | [diff] [blame] | 164 | s.subspec 'Tests' do |ss| |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 165 | ss.header_mappings_dir = '.' |
| 166 | |
Muxi Yan | e2de92f | 2017-01-31 16:30:52 -0800 | [diff] [blame] | 167 | ss.dependency "#{s.name}/Interface", version |
| 168 | ss.dependency "#{s.name}/Implementation", version |
| 169 | |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 170 | ss.source_files = 'test/core/end2end/cq_verifier.{c,h}', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 171 | 'test/core/end2end/end2end_tests.{c,h}', |
Muxi Yan | 53c4c28 | 2016-11-08 13:34:02 -0800 | [diff] [blame] | 172 | 'test/core/end2end/end2end_test_utils.c', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 173 | 'test/core/end2end/tests/*.{c,h}', |
| 174 | 'test/core/end2end/data/*.{c,h}', |
Muxi Yan | e38b012 | 2017-03-16 20:53:41 -0700 | [diff] [blame] | 175 | 'test/core/util/debugger_macros.{c,h}', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 176 | 'test/core/util/test_config.{c,h}', |
| 177 | 'test/core/util/port.h', |
Craig Tiller | 46ab5f5 | 2017-02-28 08:40:19 -0800 | [diff] [blame] | 178 | 'test/core/util/port.c', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 179 | 'test/core/util/port_server_client.{c,h}' |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 180 | end |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 181 | end |