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 | # |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 10 | # Copyright 2015, Google Inc. |
| 11 | # All rights reserved. |
| 12 | # |
| 13 | # Redistribution and use in source and binary forms, with or without |
| 14 | # modification, are permitted provided that the following conditions are |
| 15 | # met: |
| 16 | # |
| 17 | # * Redistributions of source code must retain the above copyright |
| 18 | # notice, this list of conditions and the following disclaimer. |
| 19 | # * Redistributions in binary form must reproduce the above |
| 20 | # copyright notice, this list of conditions and the following disclaimer |
| 21 | # in the documentation and/or other materials provided with the |
| 22 | # distribution. |
| 23 | # * Neither the name of Google Inc. nor the names of its |
| 24 | # contributors may be used to endorse or promote products derived from |
| 25 | # this software without specific prior written permission. |
| 26 | # |
| 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 28 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 29 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 30 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 31 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 32 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 34 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 35 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 36 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | |
| 39 | <%! |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 40 | def grpc_private_files(libs): |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 41 | out = [] |
| 42 | for lib in libs: |
| 43 | if lib.name in ("grpc", "gpr"): |
| 44 | out += lib.get('headers', []) |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 45 | out += lib.get('src', []) |
| 46 | return out; |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 47 | |
| 48 | def grpc_public_headers(libs): |
| 49 | out = [] |
| 50 | for lib in libs: |
| 51 | if lib.name in ("grpc", "gpr"): |
| 52 | out += lib.get('public_headers', []) |
| 53 | return out |
| 54 | |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 55 | def grpc_private_headers(libs): |
| 56 | out = [] |
| 57 | for lib in libs: |
| 58 | if lib.name in ("grpc", "gpr"): |
| 59 | out += lib.get('headers', []) |
| 60 | return out |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 61 | |
| 62 | def ruby_multiline_list(files, indent): |
| 63 | return (',\n' + indent*' ').join('\'%s\'' % f for f in files) |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 64 | %> |
| 65 | Pod::Spec.new do |s| |
| 66 | s.name = 'gRPC-Core' |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 67 | version = '${settings.version}' |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 68 | s.version = version |
| 69 | s.summary = 'Core cross-platform gRPC library, written in C' |
| 70 | s.homepage = 'http://www.grpc.io' |
| 71 | s.license = 'New BSD' |
| 72 | s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } |
| 73 | |
| 74 | s.source = { |
| 75 | :git => 'https://github.com/grpc/grpc.git', |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 76 | :tag => "v#{version}", |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 77 | # TODO(jcanizales): Depend explicitly on the nanopb pod, and disable submodules. |
Jorge Canizales | 66c8ddd | 2016-06-08 17:39:40 -0700 | [diff] [blame] | 78 | :submodules => true, |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | s.ios.deployment_target = '7.1' |
| 82 | s.osx.deployment_target = '10.9' |
| 83 | s.requires_arc = false |
| 84 | |
| 85 | name = 'grpc' |
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 | # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. |
| 88 | # This lets users write their includes like `#include <grpc/grpc.h>` as opposed to `#include |
| 89 | # <gRPC-Core/grpc.h>`. |
| 90 | s.module_name = name |
| 91 | |
| 92 | # When creating a dynamic framework, copy the headers under `include/grpc/` into the root of |
| 93 | # the `Headers/` directory of the framework (i.e., not under `Headers/include/grpc`). |
| 94 | # |
| 95 | # TODO(jcanizales): Debug why this doesn't work on macOS. |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 96 | s.header_mappings_dir = 'include/grpc' |
| 97 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 98 | # The above has an undesired effect when creating a static library: It forces users to write |
| 99 | # includes like `#include <gRPC-Core/grpc.h>`. `s.header_dir` adds a path prefix to that, and |
| 100 | # because Cocoapods lets omit the pod name when including headers of static libraries, the |
| 101 | # following lets users write `#include <grpc/grpc.h>`. |
| 102 | s.header_dir = name |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 103 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 104 | # 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] | 105 | s.module_map = 'include/grpc/module.modulemap' |
| 106 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 107 | # To compile the library, we need the user headers search path (quoted includes) to point to the |
| 108 | # root of the repo, and the system headers search path (angled includes) to point to `include/`. |
| 109 | # Cocoapods effectively clones the repo under `<Podfile dir>/Pods/gRPC-Core/`, and sets a build |
| 110 | # variable called `$(PODS_ROOT)` to `<Podfile dir>/Pods/`, so we use that. |
| 111 | # |
| 112 | # Relying on the file structure under $(PODS_ROOT) isn't officially supported in Cocoapods, as it |
| 113 | # is taken as an implementation detail. We've asked for an alternative, and have been told that |
| 114 | # what we're doing should keep working: https://github.com/CocoaPods/CocoaPods/issues/4386 |
| 115 | # |
| 116 | # The `src_root` value of `$(PODS_ROOT)/gRPC-Core` assumes Cocoapods is installing this pod from |
| 117 | # its remote repo. For local development of this library, enabled by using `:path` in the Podfile, |
| 118 | # that assumption is wrong. In such case, the following settings need to be reset with the |
| 119 | # appropriate value of `src_root`. This can be accomplished in the `pre_install` hook of the |
| 120 | # Podfile; see `src/objective-c/tests/Podfile` for an example. |
| 121 | src_root = '$(PODS_ROOT)/gRPC-Core' |
| 122 | s.pod_target_xcconfig = { |
| 123 | 'GRPC_SRC_ROOT' => src_root, |
| 124 | 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', |
| 125 | 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', |
| 126 | # If we don't set these two settings, `include/grpc/support/time.h` and |
| 127 | # `src/core/lib/support/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the |
| 128 | # build. |
| 129 | 'USE_HEADERMAP' => 'NO', |
| 130 | 'ALWAYS_SEARCH_USER_PATHS' => 'NO', |
| 131 | } |
Jorge Canizales | 3775074 | 2016-06-08 20:10:20 -0700 | [diff] [blame] | 132 | |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 133 | s.default_subspecs = 'Interface', 'Implementation' |
| 134 | |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 135 | # Like many other C libraries, gRPC-Core has its public headers under `include/<libname>/` and its |
| 136 | # sources and private headers in other directories outside `include/`. Cocoapods' linter doesn't |
| 137 | # allow any header to be listed outside the `header_mappings_dir` (even though doing so works in |
| 138 | # practice). Because we need our `header_mappings_dir` to be `include/grpc/` for the reason |
| 139 | # mentioned above, we work around the linter limitation by dividing the pod into two subspecs, one |
| 140 | # for public headers and the other for implementation. Each gets its own `header_mappings_dir`, |
| 141 | # making the linter happy. |
| 142 | # |
| 143 | # The list of source files is generated by a template: `templates/gRPC-Core.podspec.template`. It |
| 144 | # can be regenerated from the template by running `tools/buildgen/generate_projects.sh`. |
| 145 | s.subspec 'Interface' do |ss| |
| 146 | ss.header_mappings_dir = 'include/grpc' |
| 147 | |
| 148 | ss.source_files = ${ruby_multiline_list(grpc_public_headers(libs), 22)} |
| 149 | end |
| 150 | s.subspec 'Implementation' do |ss| |
| 151 | ss.header_mappings_dir = '.' |
| 152 | ss.libraries = 'z' |
| 153 | ss.dependency "#{s.name}/Interface", version |
Muxi Yan | 690aee6 | 2017-01-27 02:52:47 +0000 | [diff] [blame] | 154 | ss.dependency 'BoringSSL', '~> 8.0' |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 155 | |
| 156 | # To save you from scrolling, this is the last part of the podspec. |
| 157 | ss.source_files = ${ruby_multiline_list(grpc_private_files(libs), 22)} |
| 158 | |
| 159 | ss.private_header_files = ${ruby_multiline_list(grpc_private_headers(libs), 30)} |
| 160 | end |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 161 | |
| 162 | s.subspec 'Cronet-Interface' do |ss| |
| 163 | ss.header_mappings_dir = 'include/grpc' |
Muxi Yan | 0a2fae9 | 2017-02-01 14:49:03 -0800 | [diff] [blame] | 164 | ss.source_files = 'include/grpc/grpc_cronet.h', |
| 165 | 'src/core/ext/transport/cronet/transport/cronet_transport.h' |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 166 | end |
| 167 | |
Muxi Yan | f8372c6 | 2016-07-29 09:58:55 -0700 | [diff] [blame] | 168 | s.subspec 'Cronet-Implementation' do |ss| |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 169 | ss.header_mappings_dir = '.' |
Muxi Yan | e2de92f | 2017-01-31 16:30:52 -0800 | [diff] [blame] | 170 | |
| 171 | ss.dependency "#{s.name}/Interface", version |
| 172 | ss.dependency "#{s.name}/Implementation", version |
| 173 | ss.dependency "#{s.name}/Cronet-Interface", version |
| 174 | |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 175 | ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c', |
Muxi Yan | e2de92f | 2017-01-31 16:30:52 -0800 | [diff] [blame] | 176 | 'src/core/ext/transport/cronet/transport/cronet_transport.c', |
Muxi Yan | f0a1269 | 2017-01-31 16:36:56 -0800 | [diff] [blame] | 177 | 'third_party/objective_c/Cronet/bidirectional_stream_c.h' |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 178 | end |
| 179 | |
Muxi Yan | f8372c6 | 2016-07-29 09:58:55 -0700 | [diff] [blame] | 180 | s.subspec 'Tests' do |ss| |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 181 | ss.header_mappings_dir = '.' |
| 182 | |
Muxi Yan | e2de92f | 2017-01-31 16:30:52 -0800 | [diff] [blame] | 183 | ss.dependency "#{s.name}/Interface", version |
| 184 | ss.dependency "#{s.name}/Implementation", version |
| 185 | |
Muxi Yan | 2a5072e | 2016-07-27 15:10:22 -0700 | [diff] [blame] | 186 | ss.source_files = 'test/core/end2end/cq_verifier.{c,h}', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 187 | 'test/core/end2end/end2end_tests.{c,h}', |
Muxi Yan | 53c4c28 | 2016-11-08 13:34:02 -0800 | [diff] [blame] | 188 | 'test/core/end2end/end2end_test_utils.c', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 189 | 'test/core/end2end/tests/*.{c,h}', |
| 190 | 'test/core/end2end/data/*.{c,h}', |
Muxi Yan | d592357 | 2017-02-06 11:25:59 -0800 | [diff] [blame] | 191 | 'test/core/util/debugger_macros.c', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 192 | 'test/core/util/test_config.{c,h}', |
| 193 | 'test/core/util/port.h', |
Craig Tiller | 46ab5f5 | 2017-02-28 08:40:19 -0800 | [diff] [blame] | 194 | 'test/core/util/port.c', |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 195 | 'test/core/util/port_server_client.{c,h}' |
Muxi Yan | 37480eb | 2016-07-14 16:22:03 -0700 | [diff] [blame] | 196 | end |
Jorge Canizales | e487a72 | 2016-04-30 12:05:26 -0700 | [diff] [blame] | 197 | end |