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 17load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") 18load("//bazel:grpc_build_system.bzl", "grpc_generate_objc_one_off_targets", "grpc_objc_library") 19 20licenses(["notice"]) 21 22package( 23 default_visibility = ["//visibility:public"], 24 features = ["-layering_check"], 25) 26 27exports_files(["LICENSE"]) 28 29grpc_generate_objc_one_off_targets() 30 31grpc_objc_library( 32 name = "rx_library_headers", 33 hdrs = glob([ 34 "RxLibrary/*.h", 35 ]), 36 includes = ["."], 37) 38 39grpc_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 51grpc_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 62grpc_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 78grpc_objc_library( 79 name = "grpc_objc_interface_types", 80 srcs = [ 81 "GRPCClient/GRPCTypes.mm", 82 ], 83 hdrs = [ 84 "GRPCClient/GRPCTypes.h", 85 ], 86) 87 88grpc_objc_library( 89 name = "grpc_objc_interface", 90 srcs = [ 91 "GRPCClient/GRPCCall.mm", 92 "GRPCClient/GRPCCall+Interceptor.mm", 93 "GRPCClient/GRPCCallOptions.mm", 94 "GRPCClient/GRPCInterceptor.mm", 95 "GRPCClient/GRPCTransport.mm", 96 "GRPCClient/private/GRPCTransport+Private.mm", 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 117grpc_objc_library( 118 name = "grpc_objc_client", 119 srcs = [ 120 "GRPCClient/GRPCCall+ChannelArg.mm", 121 "GRPCClient/GRPCCall+ChannelCredentials.mm", 122 "GRPCClient/GRPCCall+Cronet.mm", 123 "GRPCClient/GRPCCall+OAuth2.mm", 124 "GRPCClient/GRPCCall+Tests.mm", 125 "GRPCClient/GRPCCallLegacy.mm", 126 ] + glob(["GRPCClient/private/GRPCCore/*.mm"]), 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 147alias( 148 name = "grpc_objc_client_core", 149 actual = "grpc_objc_client", 150) 151 152grpc_objc_library( 153 name = "proto_objc_rpc_legacy_header", 154 hdrs = [ 155 "ProtoRPC/ProtoRPCLegacy.h", 156 ], 157 includes = ["."], 158) 159 160grpc_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 181grpc_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 202apple_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 209grpc_objc_library( 210 name = "grpc_objc_client_core_internal_testing", 211 srcs = [ 212 "GRPCClient/GRPCCall+ChannelArg.mm", 213 "GRPCClient/GRPCCall+ChannelCredentials.mm", 214 "GRPCClient/GRPCCall+Cronet.mm", 215 "GRPCClient/GRPCCall+OAuth2.mm", 216 "GRPCClient/GRPCCall+Tests.mm", 217 "GRPCClient/GRPCCallLegacy.mm", 218 "GRPCClient/internal_testing/GRPCCall+InternalTests.mm", 219 ] + glob(["GRPCClient/private/GRPCCore/*.mm"]), 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# TODO: Enable this again once @CronetFramework is working 243#grpc_objc_library( 244# name = "grpc_objc_client_core_cronet_testing", 245# srcs = glob(["GRPCClient/private/GRPCCore/GRPCCoreCronet/*.mm"]), 246# hdrs = glob(["GRPCClient/private/GRPCCore/GRPCCoreCronet/*.h"]), 247# deps = [ 248# ":grpc_objc_client_core_internal_testing", 249# "//:grpc_cronet_hdrs", 250# "//src/core/ext/transport/cronet:grpc_transport_cronet_client_secure", 251# "@CronetFramework", 252# ], 253#) 254 255grpc_objc_library( 256 name = "proto_objc_rpc_internal_testing", 257 srcs = [ 258 "ProtoRPC/ProtoRPCLegacy.m", 259 "ProtoRPC/ProtoServiceLegacy.m", 260 ], 261 hdrs = [ 262 "ProtoRPC/ProtoMethod.h", 263 "ProtoRPC/ProtoRPC.h", 264 "ProtoRPC/ProtoRPCLegacy.h", 265 "ProtoRPC/ProtoService.h", 266 ], 267 deps = [ 268 ":grpc_objc_client_core_internal_testing", 269 ":proto_objc_rpc_legacy_header", 270 ":proto_objc_rpc_v2", 271 ":rx_library", 272 "@com_google_protobuf//:protobuf_objc", 273 ], 274) 275 276alias( 277 name = "grpc_objc_client_internal_testing", 278 actual = "proto_objc_rpc_internal_testing", 279) 280