1"""Load dependencies needed to compile and test the grpc library as a 3rd-party consumer."""
2
3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
5
6def grpc_deps():
7    """Loads dependencies need to compile and test the grpc library."""
8
9    native.bind(
10        name = "upb_lib",
11        actual = "@upb//:upb",
12    )
13
14    native.bind(
15        name = "upb_lib_descriptor",
16        actual = "@upb//:descriptor_upb_proto",
17    )
18
19    native.bind(
20        name = "upb_textformat_lib",
21        actual = "@upb//:textformat",
22    )
23
24    native.bind(
25        name = "upb_json_lib",
26        actual = "@upb//:json",
27    )
28
29    native.bind(
30        name = "absl",
31        actual = "@com_google_absl//absl",
32    )
33
34    native.bind(
35        name = "absl-base",
36        actual = "@com_google_absl//absl/base",
37    )
38
39    native.bind(
40        name = "absl-time",
41        actual = "@com_google_absl//absl/time:time",
42    )
43
44    native.bind(
45        name = "libssl",
46        actual = "@boringssl//:ssl",
47    )
48
49    native.bind(
50        name = "madler_zlib",
51        actual = "@zlib//:zlib",
52    )
53
54    native.bind(
55        name = "protobuf",
56        actual = "@com_google_protobuf//:protobuf",
57    )
58
59    native.bind(
60        name = "protobuf_clib",
61        actual = "@com_google_protobuf//:protoc_lib",
62    )
63
64    native.bind(
65        name = "protobuf_headers",
66        actual = "@com_google_protobuf//:protobuf_headers",
67    )
68
69    native.bind(
70        name = "protocol_compiler",
71        actual = "@com_google_protobuf//:protoc",
72    )
73
74    native.bind(
75        name = "cares",
76        actual = "@com_github_cares_cares//:ares",
77    )
78
79    native.bind(
80        name = "gtest",
81        actual = "@com_google_googletest//:gtest",
82    )
83
84    native.bind(
85        name = "benchmark",
86        actual = "@com_github_google_benchmark//:benchmark",
87    )
88
89    native.bind(
90        name = "re2",
91        actual = "@com_github_google_re2//:re2",
92    )
93
94    native.bind(
95        name = "grpc_cpp_plugin",
96        actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
97    )
98
99    native.bind(
100        name = "grpc++_codegen_proto",
101        actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
102    )
103
104    native.bind(
105        name = "opencensus-context",
106        actual = "@io_opencensus_cpp//opencensus/context:context",
107    )
108
109    native.bind(
110        name = "opencensus-trace",
111        actual = "@io_opencensus_cpp//opencensus/trace:trace",
112    )
113
114    native.bind(
115        name = "opencensus-trace-context_util",
116        actual = "@io_opencensus_cpp//opencensus/trace:context_util",
117    )
118
119    native.bind(
120        name = "opencensus-stats",
121        actual = "@io_opencensus_cpp//opencensus/stats:stats",
122    )
123
124    native.bind(
125        name = "opencensus-stats-test",
126        actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
127    )
128
129    native.bind(
130        name = "opencensus-with-tag-map",
131        actual = "@io_opencensus_cpp//opencensus/tags:with_tag_map",
132    )
133
134    native.bind(
135        name = "opencensus-tags",
136        actual = "@io_opencensus_cpp//opencensus/tags:tags",
137    )
138
139    native.bind(
140        name = "libuv",
141        actual = "@libuv//:libuv",
142    )
143
144    if "boringssl" not in native.existing_rules():
145        http_archive(
146            name = "boringssl",
147            # Use github mirror instead of https://boringssl.googlesource.com/boringssl
148            # to obtain a boringssl archive with consistent sha256
149            sha256 = "e8c02bb7043644dc138e422a9a3412108732b6ff30590db4a05664476b209c03",
150            strip_prefix = "boringssl-29c6e0e27268f5a43e039cd2ed4e849d6b736fc1",
151            urls = [
152                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/29c6e0e27268f5a43e039cd2ed4e849d6b736fc1.tar.gz",
153                "https://github.com/google/boringssl/archive/29c6e0e27268f5a43e039cd2ed4e849d6b736fc1.tar.gz",
154            ],
155        )
156
157    if "zlib" not in native.existing_rules():
158        http_archive(
159            name = "zlib",
160            build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
161            sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
162            strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
163            urls = [
164                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
165                "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
166            ],
167        )
168
169    if "com_google_protobuf" not in native.existing_rules():
170        http_archive(
171            name = "com_google_protobuf",
172            sha256 = "88f7b3d062759e9428394cd2b854722c7142de6d9ea1cc0514a251dcec91bc0b",
173            strip_prefix = "protobuf-19fb89416f3fdc2d6668f3738f444885575285bc",
174            urls = [
175                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/protobuf/archive/19fb89416f3fdc2d6668f3738f444885575285bc.tar.gz",
176                "https://github.com/google/protobuf/archive/19fb89416f3fdc2d6668f3738f444885575285bc.tar.gz",
177            ],
178            patches = ["@com_github_grpc_grpc//third_party:protobuf.patch"],
179            patch_args = ["-p1"],
180        )
181
182    if "com_google_googletest" not in native.existing_rules():
183        http_archive(
184            name = "com_google_googletest",
185            sha256 = "443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468",
186            strip_prefix = "googletest-c9ccac7cb7345901884aabf5d1a786cfa6e2f397",
187            urls = [
188                # 2019-08-19
189                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/googletest/archive/c9ccac7cb7345901884aabf5d1a786cfa6e2f397.tar.gz",
190                "https://github.com/google/googletest/archive/c9ccac7cb7345901884aabf5d1a786cfa6e2f397.tar.gz",
191            ],
192        )
193
194    if "rules_cc" not in native.existing_rules():
195        http_archive(
196            name = "rules_cc",
197            sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
198            strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
199            urls = [
200                #2019-08-15
201                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
202                "https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
203            ],
204        )
205
206    if "com_github_google_benchmark" not in native.existing_rules():
207        http_archive(
208            name = "com_github_google_benchmark",
209            sha256 = "f68aec93154d010324c05bcd8c5cc53468b87af88d87acb5ddcfaa1bba044837",
210            strip_prefix = "benchmark-090faecb454fbd6e6e17a75ef8146acb037118d4",
211            urls = [
212                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/benchmark/archive/090faecb454fbd6e6e17a75ef8146acb037118d4.tar.gz",
213                "https://github.com/google/benchmark/archive/090faecb454fbd6e6e17a75ef8146acb037118d4.tar.gz",
214            ],
215        )
216
217    if "com_github_google_re2" not in native.existing_rules():
218        http_archive(
219            name = "com_github_google_re2",
220            sha256 = "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
221            strip_prefix = "re2-aecba11114cf1fac5497aeb844b6966106de3eb6",
222            urls = [
223                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
224                "https://github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
225            ],
226        )
227
228    if "com_github_cares_cares" not in native.existing_rules():
229        http_archive(
230            name = "com_github_cares_cares",
231            build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD",
232            sha256 = "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
233            strip_prefix = "c-ares-e982924acee7f7313b4baa4ee5ec000c5e373c30",
234            urls = [
235                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
236                "https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
237            ],
238        )
239
240    if "com_google_absl" not in native.existing_rules():
241        http_archive(
242            name = "com_google_absl",
243            sha256 = "3d74cdc98b42fd4257d91f652575206de195e2c824fcd8d6e6d227f85cb143ef",
244            strip_prefix = "abseil-cpp-0f3bb466b868b523cf1dc9b2aaaed65c77b28862",
245            urls = [
246                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz",
247                "https://github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz",
248            ],
249        )
250
251    if "bazel_toolchains" not in native.existing_rules():
252        # list of releases is at https://releases.bazel.build/bazel-toolchains.html
253        http_archive(
254            name = "bazel_toolchains",
255            sha256 = "0b36eef8a66f39c8dbae88e522d5bbbef49d5e66e834a982402c79962281be10",
256            strip_prefix = "bazel-toolchains-1.0.1",
257            urls = [
258                "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1.0.1.tar.gz",
259                "https://github.com/bazelbuild/bazel-toolchains/releases/download/1.0.1/bazel-toolchains-1.0.1.tar.gz",
260            ],
261        )
262
263    if "bazel_skylib" not in native.existing_rules():
264        http_archive(
265            name = "bazel_skylib",
266            urls = [
267                "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
268                "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
269            ],
270            sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
271        )
272
273    if "bazel_compdb" not in native.existing_rules():
274        http_archive(
275            name = "bazel_compdb",
276            sha256 = "bcecfd622c4ef272fd4ba42726a52e140b961c4eac23025f18b346c968a8cfb4",
277            strip_prefix = "bazel-compilation-database-0.4.5",
278            urls = [
279                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/grailbio/bazel-compilation-database/archive/0.4.5.tar.gz",
280                "https://github.com/grailbio/bazel-compilation-database/archive/0.4.5.tar.gz",
281            ],
282        )
283
284    if "io_opencensus_cpp" not in native.existing_rules():
285        http_archive(
286            name = "io_opencensus_cpp",
287            sha256 = "90d6fafa8b1a2ea613bf662731d3086e1c2ed286f458a95c81744df2dbae41b1",
288            strip_prefix = "opencensus-cpp-c9a4da319bc669a772928ffc55af4a61be1a1176",
289            urls = [
290                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-cpp/archive/c9a4da319bc669a772928ffc55af4a61be1a1176.tar.gz",
291                "https://github.com/census-instrumentation/opencensus-cpp/archive/c9a4da319bc669a772928ffc55af4a61be1a1176.tar.gz",
292            ],
293        )
294
295    if "upb" not in native.existing_rules():
296        http_archive(
297            name = "upb",
298            sha256 = "c0b97bf91dfea7e8d7579c24e2ecdd02d10b00f3c5defc3dce23d95100d0e664",
299            strip_prefix = "upb-60607da72e89ba0c84c84054d2e562d8b6b61177",
300            urls = [
301                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/60607da72e89ba0c84c84054d2e562d8b6b61177.tar.gz",
302                "https://github.com/protocolbuffers/upb/archive/60607da72e89ba0c84c84054d2e562d8b6b61177.tar.gz",
303            ],
304        )
305
306    if "envoy_api" not in native.existing_rules():
307        http_archive(
308            name = "envoy_api",
309            sha256 = "466585f253471259ce17641348149f458270316e81ec6702fdd8bf0b1b681256",
310            strip_prefix = "data-plane-api-9997e1137cdb59e622af13e57ca915a2f3c9f84f",
311            urls = [
312                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/envoyproxy/data-plane-api/archive/9997e1137cdb59e622af13e57ca915a2f3c9f84f.tar.gz",
313                "https://github.com/envoyproxy/data-plane-api/archive/9997e1137cdb59e622af13e57ca915a2f3c9f84f.tar.gz",
314            ],
315        )
316
317    if "io_bazel_rules_go" not in native.existing_rules():
318        http_archive(
319            name = "io_bazel_rules_go",
320            sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
321            urls = [
322                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
323                "https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
324            ],
325        )
326
327    if "build_bazel_rules_apple" not in native.existing_rules():
328        http_archive(
329            name = "build_bazel_rules_apple",
330            strip_prefix = "rules_apple-b869b0d3868d78a1d4ffd866ccb304fb68aa12c3",
331            sha256 = "bdc8e66e70b8a75da23b79f1f8c6207356df07d041d96d2189add7ee0780cf4e",
332            urls = [
333                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_apple/archive/b869b0d3868d78a1d4ffd866ccb304fb68aa12c3.tar.gz",
334                "https://github.com/bazelbuild/rules_apple/archive/b869b0d3868d78a1d4ffd866ccb304fb68aa12c3.tar.gz",
335            ],
336        )
337
338    if "build_bazel_apple_support" not in native.existing_rules():
339        http_archive(
340            name = "build_bazel_apple_support",
341            urls = [
342                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/apple_support/releases/download/0.7.1/apple_support.0.7.1.tar.gz",
343                "https://github.com/bazelbuild/apple_support/releases/download/0.7.1/apple_support.0.7.1.tar.gz",
344            ],
345            sha256 = "122ebf7fe7d1c8e938af6aeaee0efe788a3a2449ece5a8d6a428cb18d6f88033",
346        )
347
348    if "libuv" not in native.existing_rules():
349        http_archive(
350            name = "libuv",
351            build_file = "@com_github_grpc_grpc//third_party:libuv.BUILD",
352            sha256 = "dfb4fe1ff0b47340978490a14bf253475159ecfcbad46ab2a350c78f9ce3360f",
353            strip_prefix = "libuv-15ae750151ac9341e5945eb38f8982d59fb99201",
354            urls = [
355                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/libuv/libuv/archive/15ae750151ac9341e5945eb38f8982d59fb99201.tar.gz",
356                "https://github.com/libuv/libuv/archive/15ae750151ac9341e5945eb38f8982d59fb99201.tar.gz",
357            ],
358        )
359
360    grpc_python_deps()
361
362# TODO: move some dependencies from "grpc_deps" here?
363def grpc_test_only_deps():
364    """Internal, not intended for use by packages that are consuming grpc.
365       Loads dependencies that are only needed to run grpc library's tests."""
366    native.bind(
367        name = "twisted",
368        actual = "@com_github_twisted_twisted//:twisted",
369    )
370
371    native.bind(
372        name = "yaml",
373        actual = "@com_github_yaml_pyyaml//:yaml",
374    )
375
376    if "com_github_twisted_twisted" not in native.existing_rules():
377        http_archive(
378            name = "com_github_twisted_twisted",
379            sha256 = "ca17699d0d62eafc5c28daf2c7d0a18e62ae77b4137300b6c7d7868b39b06139",
380            strip_prefix = "twisted-twisted-17.5.0",
381            urls = [
382                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/twisted/twisted/archive/twisted-17.5.0.zip",
383                "https://github.com/twisted/twisted/archive/twisted-17.5.0.zip",
384            ],
385            build_file = "@com_github_grpc_grpc//third_party:twisted.BUILD",
386        )
387
388    if "com_github_yaml_pyyaml" not in native.existing_rules():
389        http_archive(
390            name = "com_github_yaml_pyyaml",
391            sha256 = "6b4314b1b2051ddb9d4fcd1634e1fa9c1bb4012954273c9ff3ef689f6ec6c93e",
392            strip_prefix = "pyyaml-3.12",
393            urls = [
394                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/yaml/pyyaml/archive/3.12.zip",
395                "https://github.com/yaml/pyyaml/archive/3.12.zip",
396            ],
397            build_file = "@com_github_grpc_grpc//third_party:yaml.BUILD",
398        )
399
400    if "com_github_twisted_incremental" not in native.existing_rules():
401        http_archive(
402            name = "com_github_twisted_incremental",
403            sha256 = "f0ca93359ee70243ff7fbf2d904a6291810bd88cb80ed4aca6fa77f318a41a36",
404            strip_prefix = "incremental-incremental-17.5.0",
405            urls = [
406                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/twisted/incremental/archive/incremental-17.5.0.zip",
407                "https://github.com/twisted/incremental/archive/incremental-17.5.0.zip",
408            ],
409            build_file = "@com_github_grpc_grpc//third_party:incremental.BUILD",
410        )
411
412    if "com_github_zopefoundation_zope_interface" not in native.existing_rules():
413        http_archive(
414            name = "com_github_zopefoundation_zope_interface",
415            sha256 = "e9579fc6149294339897be3aa9ecd8a29217c0b013fe6f44fcdae00e3204198a",
416            strip_prefix = "zope.interface-4.4.3",
417            urls = [
418                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/zopefoundation/zope.interface/archive/4.4.3.zip",
419                "https://github.com/zopefoundation/zope.interface/archive/4.4.3.zip",
420            ],
421            build_file = "@com_github_grpc_grpc//third_party:zope_interface.BUILD",
422        )
423
424    if "com_github_twisted_constantly" not in native.existing_rules():
425        http_archive(
426            name = "com_github_twisted_constantly",
427            sha256 = "2702cd322161a579d2c0dbf94af4e57712eedc7bd7bbbdc554a230544f7d346c",
428            strip_prefix = "constantly-15.1.0",
429            urls = [
430                "https://storage.googleapis.com/grpc-bazel-mirror/github.com/twisted/constantly/archive/15.1.0.zip",
431                "https://github.com/twisted/constantly/archive/15.1.0.zip",
432            ],
433            build_file = "@com_github_grpc_grpc//third_party:constantly.BUILD",
434        )
435