1 # Copyright 2019 gRPC authors.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 # This is for the gRPC build system. This isn't intended to be used outsite of
17 # the BUILD file for gRPC. It contains the mapping for the template system we
18 # use to generate other platform's build system files.
20 # Please consider that there should be a high bar for additions and changes to
22 # Each rule listed must be re-written for Google's internal build system, and
23 # each change must be ported from one to the other.
26 load("@rules_proto//proto:defs.bzl", "proto_library")
28 "//bazel:generate_objc.bzl",
31 "generate_objc_non_arc_srcs",
35 def proto_library_objc_wrapper(
39 use_well_known_protos = False):
40 """proto_library for adding dependencies to google/protobuf protos
41 use_well_known_protos - ignored in open source version
49 def grpc_objc_examples_library(
59 """objc_library for testing, only works in //src/objective-c/exmaples
64 srcs: all source files (.m)
65 textual_hdrs: private headers
66 data: any other bundle resources
67 defines: preprocessors
69 includes: added to search path, always [the path to objc directory]
76 textual_hdrs = textual_hdrs,
80 sdk_frameworks = sdk_frameworks,
81 deps = deps + [":RemoteTest"],
84 def grpc_objc_testing_library(
93 """objc_library for testing, only works in //src/objective-c/tests
98 srcs: all source files (.m)
99 textual_hdrs: private headers
100 data: any other bundle resources
101 defines: preprocessors
102 includes: added to search path, always [the path to objc directory]
108 "//src/objective-c:grpc_objc_client_internal_testing",
111 if not name == "TestConfigs":
112 additional_deps += [":TestConfigs"]
118 textual_hdrs = textual_hdrs,
122 deps = deps + additional_deps,
125 def local_objc_grpc_library(name, deps, testing = True, srcs = [], use_well_known_protos = False, **kwargs):
126 """!!For local targets within the gRPC repository only!! Will not work outside of the repo
128 objc_grpc_library_name = "_" + name + "_objc_grpc_library"
131 name = objc_grpc_library_name,
134 use_well_known_protos = use_well_known_protos,
139 name = objc_grpc_library_name + "_hdrs",
140 src = ":" + objc_grpc_library_name,
143 generate_objc_non_arc_srcs(
144 name = objc_grpc_library_name + "_non_arc_srcs",
145 src = ":" + objc_grpc_library_name,
151 name = objc_grpc_library_name + "_srcs",
152 src = ":" + objc_grpc_library_name,
154 arc_srcs = [":" + objc_grpc_library_name + "_srcs"]
156 library_deps = ["@com_google_protobuf//:protobuf_objc"]
158 library_deps += ["//src/objective-c:grpc_objc_client_internal_testing"]
160 library_deps += ["//src/objective-c:proto_objc_rpc"]
164 hdrs = [":" + objc_grpc_library_name + "_hdrs"],
165 non_arc_srcs = [":" + objc_grpc_library_name + "_non_arc_srcs"],
168 "GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0",
169 "GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=0",
171 includes = ["_generated_protos"],