• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17licenses(["notice"])  # 3-clause BSD
18
19package(default_visibility = ["//visibility:public"])
20
21load(
22    "//src/objective-c:grpc_objc_internal_library.bzl",
23    "grpc_objc_examples_library",
24    "local_objc_grpc_library",
25    "proto_library_objc_wrapper",
26)
27load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
28load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application")
29load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension")
30
31proto_library_objc_wrapper(
32    name = "messages_proto",
33    srcs = ["RemoteTestClient/messages.proto"],
34)
35
36proto_library_objc_wrapper(
37    name = "test_proto",
38    srcs = ["RemoteTestClient/test.proto"],
39    use_well_known_protos = True,
40    deps = [":messages_proto"],
41)
42
43# use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo
44local_objc_grpc_library(
45    name = "RemoteTest",
46    srcs = ["RemoteTestClient/test.proto"],
47    use_well_known_protos = True,
48    deps = [
49        "//src/objective-c/examples:test_proto",
50    ],
51)
52
53# Proof that without this works without srcs
54local_objc_grpc_library(
55    name = "test_objc",
56    use_well_known_protos = True,
57    deps = [
58        "//src/objective-c/examples:test_proto",
59    ],
60)
61
62grpc_objc_examples_library(
63    name = "Sample-lib",
64    srcs = glob(["Sample/Sample/**/*.m"]),
65    hdrs = glob(["Sample/Sample/**/*.h"]),
66    data = glob([
67        "Sample/Sample/Base.lproj/**",
68        "Sample/Sample/Images.xcassets/**",
69    ]),
70)
71
72ios_application(
73    name = "Sample",
74    bundle_id = "io.grpc.Sample",
75    families = [
76        "iphone",
77        "ipad",
78    ],
79    infoplists = ["Sample/Sample/Info.plist"],
80    minimum_os_version = "9.0",
81    visibility = ["//visibility:public"],
82    deps = ["Sample-lib"],
83)
84
85grpc_objc_examples_library(
86    name = "InterceptorSample-lib",
87    srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]),
88    hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]),
89    data = glob([
90        "InterceptorSample/InterceptorSample/Base.lproj/**",
91        "InterceptorSample/InterceptorSample/Images.xcassets/**",
92    ]),
93)
94
95ios_application(
96    name = "InterceptorSample",
97    bundle_id = "io.grpc.InterceptorSample",
98    families = [
99        "iphone",
100        "ipad",
101    ],
102    infoplists = ["InterceptorSample/InterceptorSample/Info.plist"],
103    minimum_os_version = "9.0",  # Safe Area Layout Guide used
104    deps = ["InterceptorSample-lib"],
105)
106
107grpc_objc_examples_library(
108    name = "tvOS-sample-lib",
109    srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]),
110    hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]),
111    data = glob([
112        "tvOS-sample/tvOS-sample/Base.lproj/**",
113        "tvOS-sample/tvOS-sample/Images.xcassets/**",
114    ]),
115)
116
117# c-ares does not support tvOS CPU architecture with Bazel yet
118tvos_application(
119    name = "tvOS-sample",
120    bundle_id = "io.grpc.tvOS-sample",
121    infoplists = ["tvOS-sample/tvOS-sample/Info.plist"],
122    minimum_os_version = "10.0",
123    deps = [":tvOS-sample-lib"],
124)
125
126grpc_objc_examples_library(
127    name = "watchOS-sample-iOS-lib",
128    srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]),
129    hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]),
130    data = glob([
131        "watchOS-sample/watchOS-sample/Base.lproj/**",
132        "watchOS-sample/watchOS-sample/Images.xcassets/**",
133    ]),
134)
135
136grpc_objc_examples_library(
137    name = "watchOS-sample-extension-lib",
138    srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]),
139    hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]),
140    sdk_frameworks = [
141        "WatchConnectivity",
142        "WatchKit",
143    ],
144)
145
146ios_application(
147    name = "watchOS-sample",
148    bundle_id = "io.grpc.watchOS-sample",
149    families = ["iphone"],
150    infoplists = ["watchOS-sample/watchOS-sample/Info.plist"],
151    minimum_os_version = "9.0",  # Safe Area Layout Guide used
152    watch_application = "watchOS-sample-watchApp",
153    deps = [":watchOS-sample-iOS-lib"],
154)
155
156# c-ares does not support watchOS CPU architecture with Bazel yet
157watchos_application(
158    name = "watchOS-sample-watchApp",
159    bundle_id = "io.grpc.watchOS-sample.watchkitapp",
160    extension = ":watchOS-sample-extension",
161    infoplists = ["watchOS-sample/WatchKit-App/Info.plist"],
162    minimum_os_version = "4.0",
163    storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"],
164)
165
166watchos_extension(
167    name = "watchOS-sample-extension",
168    bundle_id = "io.grpc.watchOS-sample.watchkitapp.watchkitextension",
169    infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"],
170    minimum_os_version = "4.0",
171    deps = [":watchOS-sample-extension-lib"],
172)
173