| 1 |
# gRPC Bazel BUILD file. |
| 2 |
# |
| 3 |
# Copyright 2019 gRPC authors. |
| 4 |
# |
| 5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
# you may not use this file except in compliance with the License. |
| 7 |
# You may obtain a copy of the License at |
| 8 |
# |
| 9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
# |
| 11 |
# Unless required by applicable law or agreed to in writing, software |
| 12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
# See the License for the specific language governing permissions and |
| 15 |
# limitations under the License. |
| 16 |
|
| 17 |
load("//bazel:grpc_build_system.bzl", "grpc_generate_objc_one_off_targets", "grpc_objc_library") |
| 18 |
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") |
| 19 |
|
| 20 |
licenses(["notice"]) |
| 21 |
|
| 22 |
package( |
| 23 |
default_visibility = ["//visibility:public"], |
| 24 |
features = ["-layering_check"], |
| 25 |
) |
| 26 |
|
| 27 |
exports_files(["LICENSE"]) |
| 28 |
|
| 29 |
grpc_generate_objc_one_off_targets() |
| 30 |
|
| 31 |
grpc_objc_library( |
| 32 |
name = "rx_library_headers", |
| 33 |
hdrs = glob([ |
| 34 |
"RxLibrary/*.h", |
| 35 |
]), |
| 36 |
includes = ["."], |
| 37 |
) |
| 38 |
|
| 39 |
grpc_objc_library( |
| 40 |
name = "rx_library", |
| 41 |
srcs = glob([ |
| 42 |
"RxLibrary/*.m", |
| 43 |
]), |
| 44 |
includes = ["."], |
| 45 |
deps = [ |
| 46 |
":rx_library_headers", |
| 47 |
":rx_library_private", |
| 48 |
], |
| 49 |
) |
| 50 |
|
| 51 |
grpc_objc_library( |
| 52 |
name = "rx_library_private", |
| 53 |
srcs = glob([ |
| 54 |
"RxLibrary/private/*.m", |
| 55 |
]), |
| 56 |
textual_hdrs = glob([ |
| 57 |
"RxLibrary/private/*.h", |
| 58 |
]), |
| 59 |
visibility = ["//visibility:private"], |
| 60 |
) |
| 61 |
|
| 62 |
grpc_objc_library( |
| 63 |
name = "grpc_objc_interface_legacy", |
| 64 |
hdrs = [ |
| 65 |
"GRPCClient/GRPCCall+ChannelArg.h", |
| 66 |
"GRPCClient/GRPCCall+ChannelCredentials.h", |
| 67 |
"GRPCClient/GRPCCall+Cronet.h", |
| 68 |
"GRPCClient/GRPCCall+OAuth2.h", |
| 69 |
"GRPCClient/GRPCCall+Tests.h", |
| 70 |
"GRPCClient/GRPCCallLegacy.h", |
| 71 |
], |
| 72 |
deps = [ |
| 73 |
":grpc_objc_interface_types", |
| 74 |
":rx_library_headers", |
| 75 |
], |
| 76 |
) |
| 77 |
|
| 78 |
grpc_objc_library( |
| 79 |
name = "grpc_objc_interface_types", |
| 80 |
srcs = [ |
| 81 |
"GRPCClient/GRPCTypes.m", |
| 82 |
], |
| 83 |
hdrs = [ |
| 84 |
"GRPCClient/GRPCTypes.h", |
| 85 |
], |
| 86 |
) |
| 87 |
|
| 88 |
grpc_objc_library( |
| 89 |
name = "grpc_objc_interface", |
| 90 |
srcs = [ |
| 91 |
"GRPCClient/GRPCCall.m", |
| 92 |
"GRPCClient/GRPCCall+Interceptor.m", |
| 93 |
"GRPCClient/GRPCCallOptions.m", |
| 94 |
"GRPCClient/GRPCInterceptor.m", |
| 95 |
"GRPCClient/GRPCTransport.m", |
| 96 |
"GRPCClient/private/GRPCTransport+Private.m", |
| 97 |
], |
| 98 |
hdrs = [ |
| 99 |
"GRPCClient/GRPCCall.h", |
| 100 |
"GRPCClient/GRPCCall+Interceptor.h", |
| 101 |
"GRPCClient/GRPCCallOptions.h", |
| 102 |
"GRPCClient/GRPCDispatchable.h", |
| 103 |
"GRPCClient/GRPCInterceptor.h", |
| 104 |
"GRPCClient/GRPCTransport.h", |
| 105 |
"GRPCClient/internal/GRPCCallOptions+Internal.h", |
| 106 |
"GRPCClient/version.h", |
| 107 |
], |
| 108 |
includes = ["."], |
| 109 |
textual_hdrs = [ |
| 110 |
"GRPCClient/private/GRPCTransport+Private.h", |
| 111 |
], |
| 112 |
deps = [ |
| 113 |
":grpc_objc_interface_legacy", |
| 114 |
], |
| 115 |
) |
| 116 |
|
| 117 |
grpc_objc_library( |
| 118 |
name = "grpc_objc_client", |
| 119 |
srcs = [ |
| 120 |
"GRPCClient/GRPCCall+ChannelArg.m", |
| 121 |
"GRPCClient/GRPCCall+ChannelCredentials.m", |
| 122 |
"GRPCClient/GRPCCall+Cronet.m", |
| 123 |
"GRPCClient/GRPCCall+OAuth2.m", |
| 124 |
"GRPCClient/GRPCCall+Tests.m", |
| 125 |
"GRPCClient/GRPCCallLegacy.m", |
| 126 |
] + glob(["GRPCClient/private/GRPCCore/*.m"]), |
| 127 |
hdrs = [ |
| 128 |
"GRPCClient/GRPCCall+ChannelArg.h", |
| 129 |
"GRPCClient/GRPCCall+ChannelCredentials.h", |
| 130 |
"GRPCClient/GRPCCall+Cronet.h", |
| 131 |
"GRPCClient/GRPCCall+OAuth2.h", |
| 132 |
"GRPCClient/GRPCCall+Tests.h", |
| 133 |
], |
| 134 |
data = [":gRPCCertificates"], |
| 135 |
includes = ["."], |
| 136 |
textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), |
| 137 |
deps = [ |
| 138 |
":grpc_objc_interface", |
| 139 |
":grpc_objc_interface_legacy", |
| 140 |
":rx_library", |
| 141 |
"//:grpc_objc", |
| 142 |
], |
| 143 |
) |
| 144 |
|
| 145 |
# TODO (mxyan): Switch "name" and "actual" when import is done |
| 146 |
# Some internal Swift projects will need to be updated with the new name |
| 147 |
alias( |
| 148 |
name = "grpc_objc_client_core", |
| 149 |
actual = "grpc_objc_client", |
| 150 |
) |
| 151 |
|
| 152 |
grpc_objc_library( |
| 153 |
name = "proto_objc_rpc_legacy_header", |
| 154 |
hdrs = [ |
| 155 |
"ProtoRPC/ProtoRPCLegacy.h", |
| 156 |
], |
| 157 |
includes = ["."], |
| 158 |
) |
| 159 |
|
| 160 |
grpc_objc_library( |
| 161 |
name = "proto_objc_rpc_v2", |
| 162 |
srcs = [ |
| 163 |
"ProtoRPC/ProtoMethod.m", |
| 164 |
"ProtoRPC/ProtoRPC.m", |
| 165 |
"ProtoRPC/ProtoService.m", |
| 166 |
], |
| 167 |
hdrs = [ |
| 168 |
"ProtoRPC/ProtoMethod.h", |
| 169 |
"ProtoRPC/ProtoRPC.h", |
| 170 |
"ProtoRPC/ProtoService.h", |
| 171 |
], |
| 172 |
defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], |
| 173 |
includes = ["."], |
| 174 |
deps = [ |
| 175 |
":grpc_objc_interface", |
| 176 |
":proto_objc_rpc_legacy_header", |
| 177 |
"@com_google_protobuf//:protobuf_objc", |
| 178 |
], |
| 179 |
) |
| 180 |
|
| 181 |
grpc_objc_library( |
| 182 |
name = "proto_objc_rpc", |
| 183 |
srcs = [ |
| 184 |
"ProtoRPC/ProtoRPCLegacy.m", |
| 185 |
"ProtoRPC/ProtoServiceLegacy.m", |
| 186 |
], |
| 187 |
hdrs = [ |
| 188 |
"ProtoRPC/ProtoMethod.h", |
| 189 |
"ProtoRPC/ProtoRPC.h", |
| 190 |
"ProtoRPC/ProtoRPCLegacy.h", |
| 191 |
"ProtoRPC/ProtoService.h", |
| 192 |
], |
| 193 |
deps = [ |
| 194 |
":grpc_objc_client_core", |
| 195 |
":proto_objc_rpc_legacy_header", |
| 196 |
":proto_objc_rpc_v2", |
| 197 |
":rx_library", |
| 198 |
"@com_google_protobuf//:protobuf_objc", |
| 199 |
], |
| 200 |
) |
| 201 |
|
| 202 |
apple_resource_bundle( |
| 203 |
# The choice of name is signicant here, since it determines the bundle name. |
| 204 |
name = "gRPCCertificates", |
| 205 |
resources = ["//:etc/roots.pem"], |
| 206 |
) |
| 207 |
|
| 208 |
# Internal target combining grpc_objc_client_core and proto_objc_rpc for testing |
| 209 |
grpc_objc_library( |
| 210 |
name = "grpc_objc_client_core_internal_testing", |
| 211 |
srcs = [ |
| 212 |
"GRPCClient/GRPCCall+ChannelArg.m", |
| 213 |
"GRPCClient/GRPCCall+ChannelCredentials.m", |
| 214 |
"GRPCClient/GRPCCall+Cronet.m", |
| 215 |
"GRPCClient/GRPCCall+OAuth2.m", |
| 216 |
"GRPCClient/GRPCCall+Tests.m", |
| 217 |
"GRPCClient/GRPCCallLegacy.m", |
| 218 |
"GRPCClient/internal_testing/GRPCCall+InternalTests.m", |
| 219 |
] + glob(["GRPCClient/private/GRPCCore/*.m"]), |
| 220 |
hdrs = [ |
| 221 |
"GRPCClient/GRPCCall+ChannelArg.h", |
| 222 |
"GRPCClient/GRPCCall+ChannelCredentials.h", |
| 223 |
"GRPCClient/GRPCCall+Cronet.h", |
| 224 |
"GRPCClient/GRPCCall+OAuth2.h", |
| 225 |
"GRPCClient/GRPCCall+Tests.h", |
| 226 |
"GRPCClient/internal_testing/GRPCCall+InternalTests.h", |
| 227 |
], |
| 228 |
data = [":gRPCCertificates"], |
| 229 |
defines = [ |
| 230 |
"GRPC_TEST_OBJC=1", |
| 231 |
], |
| 232 |
includes = ["."], |
| 233 |
textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), |
| 234 |
deps = [ |
| 235 |
":grpc_objc_interface", |
| 236 |
":grpc_objc_interface_legacy", |
| 237 |
":rx_library", |
| 238 |
"//:grpc_objc", |
| 239 |
], |
| 240 |
) |
| 241 |
|
| 242 |
grpc_objc_library( |
| 243 |
name = "grpc_objc_client_core_cronet_testing", |
| 244 |
srcs = glob(["GRPCClient/private/GRPCCore/GRPCCoreCronet/*.m"]), |
| 245 |
hdrs = glob(["GRPCClient/private/GRPCCore/GRPCCoreCronet/*.h"]), |
| 246 |
deps = [ |
| 247 |
":grpc_objc_client_core_internal_testing", |
| 248 |
"//:grpc_cronet_hdrs", |
| 249 |
"//src/core/ext/transport/cronet:grpc_transport_cronet_client_secure", |
| 250 |
"@CronetFramework", |
| 251 |
], |
| 252 |
) |
| 253 |
|
| 254 |
grpc_objc_library( |
| 255 |
name = "proto_objc_rpc_internal_testing", |
| 256 |
srcs = [ |
| 257 |
"ProtoRPC/ProtoRPCLegacy.m", |
| 258 |
"ProtoRPC/ProtoServiceLegacy.m", |
| 259 |
], |
| 260 |
hdrs = [ |
| 261 |
"ProtoRPC/ProtoMethod.h", |
| 262 |
"ProtoRPC/ProtoRPC.h", |
| 263 |
"ProtoRPC/ProtoRPCLegacy.h", |
| 264 |
"ProtoRPC/ProtoService.h", |
| 265 |
], |
| 266 |
deps = [ |
| 267 |
":grpc_objc_client_core_internal_testing", |
| 268 |
":proto_objc_rpc_legacy_header", |
| 269 |
":proto_objc_rpc_v2", |
| 270 |
":rx_library", |
| 271 |
"@com_google_protobuf//:protobuf_objc", |
| 272 |
], |
| 273 |
) |
| 274 |
|
| 275 |
alias( |
| 276 |
name = "grpc_objc_client_internal_testing", |
| 277 |
actual = "proto_objc_rpc_internal_testing", |
| 278 |
) |