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("//bazel:grpc_build_system.bzl", "grpc_generate_objc_one_off_targets", "grpc_objc_library") 18load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") 19 20licenses(["notice"]) 21 22package(default_visibility = ["//visibility:public"]) 23 24exports_files(["LICENSE"]) 25 26grpc_generate_objc_one_off_targets() 27 28grpc_objc_library( 29 name = "rx_library_headers", 30 hdrs = glob([ 31 "RxLibrary/*.h", 32 ]), 33 includes = ["."], 34) 35 36grpc_objc_library( 37 name = "rx_library", 38 srcs = glob([ 39 "RxLibrary/*.m", 40 ]), 41 includes = ["."], 42 deps = [ 43 ":rx_library_headers", 44 ":rx_library_private", 45 ], 46) 47 48grpc_objc_library( 49 name = "rx_library_private", 50 srcs = glob([ 51 "RxLibrary/private/*.m", 52 ]), 53 textual_hdrs = glob([ 54 "RxLibrary/private/*.h", 55 ]), 56 visibility = ["//visibility:private"], 57) 58 59grpc_objc_library( 60 name = "grpc_objc_interface_legacy", 61 hdrs = [ 62 "GRPCClient/GRPCCall+ChannelArg.h", 63 "GRPCClient/GRPCCall+ChannelCredentials.h", 64 "GRPCClient/GRPCCall+Cronet.h", 65 "GRPCClient/GRPCCall+OAuth2.h", 66 "GRPCClient/GRPCCall+Tests.h", 67 "GRPCClient/GRPCCallLegacy.h", 68 ], 69 deps = [ 70 ":grpc_objc_interface_types", 71 ":rx_library_headers", 72 ], 73) 74 75grpc_objc_library( 76 name = "grpc_objc_interface_types", 77 srcs = [ 78 "GRPCClient/GRPCTypes.m", 79 ], 80 hdrs = [ 81 "GRPCClient/GRPCTypes.h", 82 ], 83) 84 85grpc_objc_library( 86 name = "grpc_objc_interface", 87 srcs = [ 88 "GRPCClient/GRPCCall.m", 89 "GRPCClient/GRPCCall+Interceptor.m", 90 "GRPCClient/GRPCCallOptions.m", 91 "GRPCClient/GRPCInterceptor.m", 92 "GRPCClient/GRPCTransport.m", 93 "GRPCClient/private/GRPCTransport+Private.m", 94 ], 95 hdrs = [ 96 "GRPCClient/GRPCCall.h", 97 "GRPCClient/GRPCCall+Interceptor.h", 98 "GRPCClient/GRPCCallOptions.h", 99 "GRPCClient/GRPCDispatchable.h", 100 "GRPCClient/GRPCInterceptor.h", 101 "GRPCClient/GRPCTransport.h", 102 "GRPCClient/internal/GRPCCallOptions+Internal.h", 103 "GRPCClient/version.h", 104 ], 105 includes = ["."], 106 textual_hdrs = [ 107 "GRPCClient/private/GRPCTransport+Private.h", 108 ], 109 deps = [ 110 ":grpc_objc_interface_legacy", 111 ], 112) 113 114grpc_objc_library( 115 name = "grpc_objc_client", 116 srcs = [ 117 "GRPCClient/GRPCCall+ChannelArg.m", 118 "GRPCClient/GRPCCall+ChannelCredentials.m", 119 "GRPCClient/GRPCCall+Cronet.m", 120 "GRPCClient/GRPCCall+OAuth2.m", 121 "GRPCClient/GRPCCall+Tests.m", 122 "GRPCClient/GRPCCallLegacy.m", 123 ] + glob(["GRPCClient/private/GRPCCore/*.m"]), 124 hdrs = [ 125 "GRPCClient/GRPCCall+ChannelArg.h", 126 "GRPCClient/GRPCCall+ChannelCredentials.h", 127 "GRPCClient/GRPCCall+Cronet.h", 128 "GRPCClient/GRPCCall+OAuth2.h", 129 "GRPCClient/GRPCCall+Tests.h", 130 ], 131 data = [":gRPCCertificates"], 132 includes = ["."], 133 textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), 134 deps = [ 135 ":grpc_objc_interface", 136 ":grpc_objc_interface_legacy", 137 ":rx_library", 138 "//:grpc_objc", 139 ], 140) 141 142# TODO (mxyan): Switch "name" and "actual" when import is done 143# Some internal Swift projects will need to be updated with the new name 144alias( 145 name = "grpc_objc_client_core", 146 actual = "grpc_objc_client", 147) 148 149grpc_objc_library( 150 name = "proto_objc_rpc_legacy_header", 151 hdrs = [ 152 "ProtoRPC/ProtoRPCLegacy.h", 153 ], 154 includes = ["."], 155) 156 157grpc_objc_library( 158 name = "proto_objc_rpc_v2", 159 srcs = [ 160 "ProtoRPC/ProtoMethod.m", 161 "ProtoRPC/ProtoRPC.m", 162 "ProtoRPC/ProtoService.m", 163 ], 164 hdrs = [ 165 "ProtoRPC/ProtoMethod.h", 166 "ProtoRPC/ProtoRPC.h", 167 "ProtoRPC/ProtoService.h", 168 ], 169 defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"], 170 includes = ["."], 171 deps = [ 172 ":grpc_objc_interface", 173 ":proto_objc_rpc_legacy_header", 174 "@com_google_protobuf//:protobuf_objc", 175 ], 176) 177 178grpc_objc_library( 179 name = "proto_objc_rpc", 180 srcs = [ 181 "ProtoRPC/ProtoRPCLegacy.m", 182 "ProtoRPC/ProtoServiceLegacy.m", 183 ], 184 hdrs = [ 185 "ProtoRPC/ProtoMethod.h", 186 "ProtoRPC/ProtoRPC.h", 187 "ProtoRPC/ProtoRPCLegacy.h", 188 "ProtoRPC/ProtoService.h", 189 ], 190 deps = [ 191 ":grpc_objc_client_core", 192 ":proto_objc_rpc_legacy_header", 193 ":proto_objc_rpc_v2", 194 ":rx_library", 195 "@com_google_protobuf//:protobuf_objc", 196 ], 197) 198 199apple_resource_bundle( 200 # The choice of name is signicant here, since it determines the bundle name. 201 name = "gRPCCertificates", 202 resources = ["//:etc/roots.pem"], 203) 204 205# Internal target combining grpc_objc_client_core and proto_objc_rpc for testing 206grpc_objc_library( 207 name = "grpc_objc_client_core_internal_testing", 208 srcs = [ 209 "GRPCClient/GRPCCall+ChannelArg.m", 210 "GRPCClient/GRPCCall+ChannelCredentials.m", 211 "GRPCClient/GRPCCall+Cronet.m", 212 "GRPCClient/GRPCCall+OAuth2.m", 213 "GRPCClient/GRPCCall+Tests.m", 214 "GRPCClient/GRPCCallLegacy.m", 215 "GRPCClient/internal_testing/GRPCCall+InternalTests.m", 216 ] + glob(["GRPCClient/private/GRPCCore/*.m"]), 217 hdrs = [ 218 "GRPCClient/GRPCCall+ChannelArg.h", 219 "GRPCClient/GRPCCall+ChannelCredentials.h", 220 "GRPCClient/GRPCCall+Cronet.h", 221 "GRPCClient/GRPCCall+OAuth2.h", 222 "GRPCClient/GRPCCall+Tests.h", 223 "GRPCClient/internal_testing/GRPCCall+InternalTests.h", 224 ], 225 data = [":gRPCCertificates"], 226 defines = [ 227 "GRPC_TEST_OBJC=1", 228 ], 229 includes = ["."], 230 textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]), 231 deps = [ 232 ":grpc_objc_interface", 233 ":grpc_objc_interface_legacy", 234 ":rx_library", 235 "//:grpc_objc", 236 ], 237) 238 239grpc_objc_library( 240 name = "proto_objc_rpc_internal_testing", 241 srcs = [ 242 "ProtoRPC/ProtoRPCLegacy.m", 243 "ProtoRPC/ProtoServiceLegacy.m", 244 ], 245 hdrs = [ 246 "ProtoRPC/ProtoMethod.h", 247 "ProtoRPC/ProtoRPC.h", 248 "ProtoRPC/ProtoRPCLegacy.h", 249 "ProtoRPC/ProtoService.h", 250 ], 251 deps = [ 252 ":grpc_objc_client_core_internal_testing", 253 ":proto_objc_rpc_legacy_header", 254 ":proto_objc_rpc_v2", 255 ":rx_library", 256 "@com_google_protobuf//:protobuf_objc", 257 ], 258) 259 260alias( 261 name = "grpc_objc_client_internal_testing", 262 actual = "proto_objc_rpc_internal_testing", 263) 264