Imported Upstream version 1.21.0
[platform/upstream/grpc.git] / bazel / grpc_deps.bzl
1 """Load dependencies needed to compile and test the grpc library as a 3rd-party consumer."""
2
3 load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5
6 def grpc_deps():
7     """Loads dependencies need to compile and test the grpc library."""
8
9     native.bind(
10         name = "nanopb",
11         actual = "@com_github_nanopb_nanopb//:nanopb",
12     )
13
14     native.bind(
15         name = "upb_lib",
16         actual = "@upb//:upb",
17     )
18
19     native.bind(
20         name = "absl-base",
21         actual = "@com_google_absl//absl/base",
22     )
23
24     native.bind(
25         name = "absl-time",
26         actual = "@com_google_absl//absl/time:time",
27     )
28
29     native.bind(
30         name = "libssl",
31         actual = "@boringssl//:ssl",
32     )
33
34     native.bind(
35         name = "zlib",
36         actual = "@com_github_madler_zlib//:z",
37     )
38
39     native.bind(
40         name = "protobuf",
41         actual = "@com_google_protobuf//:protobuf",
42     )
43
44     native.bind(
45         name = "protobuf_clib",
46         actual = "@com_google_protobuf//:protoc_lib",
47     )
48
49     native.bind(
50         name = "protobuf_headers",
51         actual = "@com_google_protobuf//:protobuf_headers",
52     )
53
54     native.bind(
55         name = "protocol_compiler",
56         actual = "@com_google_protobuf//:protoc",
57     )
58
59     native.bind(
60         name = "cares",
61         actual = "@com_github_cares_cares//:ares",
62     )
63
64     native.bind(
65         name = "gtest",
66         actual = "@com_github_google_googletest//:gtest",
67     )
68
69     native.bind(
70         name = "gmock",
71         actual = "@com_github_google_googletest//:gmock",
72     )
73
74     native.bind(
75         name = "benchmark",
76         actual = "@com_github_google_benchmark//:benchmark",
77     )
78
79     native.bind(
80         name = "gflags",
81         actual = "@com_github_gflags_gflags//:gflags",
82     )
83
84     native.bind(
85         name = "grpc_cpp_plugin",
86         actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
87     )
88
89     native.bind(
90         name = "grpc++_codegen_proto",
91         actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
92     )
93
94     native.bind(
95         name = "opencensus-trace",
96         actual = "@io_opencensus_cpp//opencensus/trace:trace",
97     )
98
99     native.bind(
100         name = "opencensus-stats",
101         actual = "@io_opencensus_cpp//opencensus/stats:stats",
102     )
103
104     native.bind(
105         name = "opencensus-stats-test",
106         actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
107     )
108
109     if "boringssl" not in native.existing_rules():
110         http_archive(
111             name = "boringssl",
112             # on the chromium-stable-with-bazel branch
113             # NOTE: This URL generates a tarball containing dynamic date
114             # information, so the sha256 is not consistent.
115             url = "https://boringssl.googlesource.com/boringssl/+archive/afc30d43eef92979b05776ec0963c9cede5fb80f.tar.gz",
116         )
117
118     if "com_github_madler_zlib" not in native.existing_rules():
119         http_archive(
120             name = "com_github_madler_zlib",
121             build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
122             sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
123             strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
124             url = "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
125         )
126
127     if "com_google_protobuf" not in native.existing_rules():
128         http_archive(
129             name = "com_google_protobuf",
130             sha256 = "cf9e2fb1d2cd30ec9d51ff1749045208bd641f290f64b85046485934b0e03783",
131             strip_prefix = "protobuf-582743bf40c5d3639a70f98f183914a2c0cd0680",
132             url = "https://github.com/google/protobuf/archive/582743bf40c5d3639a70f98f183914a2c0cd0680.tar.gz",
133         )
134
135     if "com_github_nanopb_nanopb" not in native.existing_rules():
136         http_archive(
137             name = "com_github_nanopb_nanopb",
138             build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
139             sha256 = "8bbbb1e78d4ddb0a1919276924ab10d11b631df48b657d960e0c795a25515735",
140             strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b",
141             url = "https://github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz",
142         )
143
144     if "com_github_google_googletest" not in native.existing_rules():
145         http_archive(
146             name = "com_github_google_googletest",
147             build_file = "@com_github_grpc_grpc//third_party:gtest.BUILD",
148             sha256 = "175a22300b3450e27e5f2e6f95cc9abca74617cbc21a1e0ed19bdfbd22ea0305",
149             strip_prefix = "googletest-ec44c6c1675c25b9827aacd08c02433cccde7780",
150             url = "https://github.com/google/googletest/archive/ec44c6c1675c25b9827aacd08c02433cccde7780.tar.gz",
151         )
152
153     if "com_github_gflags_gflags" not in native.existing_rules():
154         http_archive(
155             name = "com_github_gflags_gflags",
156             sha256 = "63ae70ea3e05780f7547d03503a53de3a7d2d83ad1caaa443a31cb20aea28654",
157             strip_prefix = "gflags-28f50e0fed19872e0fd50dd23ce2ee8cd759338e",
158             url = "https://github.com/gflags/gflags/archive/28f50e0fed19872e0fd50dd23ce2ee8cd759338e.tar.gz",
159         )
160
161     if "com_github_google_benchmark" not in native.existing_rules():
162         http_archive(
163             name = "com_github_google_benchmark",
164             sha256 = "c7682e9007ddfd94072647abab3e89ffd9084089460ae47d67060974467b58bf",
165             strip_prefix = "benchmark-e776aa0275e293707b6a0901e0e8d8a8a3679508",
166             url = "https://github.com/google/benchmark/archive/e776aa0275e293707b6a0901e0e8d8a8a3679508.tar.gz",
167         )
168
169     if "com_github_cares_cares" not in native.existing_rules():
170         http_archive(
171             name = "com_github_cares_cares",
172             build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD",
173             sha256 = "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
174             strip_prefix = "c-ares-e982924acee7f7313b4baa4ee5ec000c5e373c30",
175             url = "https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
176         )
177
178     if "com_google_absl" not in native.existing_rules():
179         http_archive(
180             name = "com_google_absl",
181             sha256 = "5fe2a3a8f8378e81d4d3db6541f48030e04233ccd2d6c7e9d981ed577b314ae8",
182             strip_prefix = "abseil-cpp-308ce31528a7edfa39f5f6d36142278a0ae1bf45",
183             url = "https://github.com/abseil/abseil-cpp/archive/308ce31528a7edfa39f5f6d36142278a0ae1bf45.tar.gz",
184         )
185
186     if "bazel_toolchains" not in native.existing_rules():
187         http_archive(
188             name = "bazel_toolchains",
189             sha256 = "67335b3563d9b67dc2550b8f27cc689b64fadac491e69ce78763d9ba894cc5cc",
190             strip_prefix = "bazel-toolchains-cddc376d428ada2927ad359211c3e356bd9c9fbb",
191             urls = [
192                 "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/cddc376d428ada2927ad359211c3e356bd9c9fbb.tar.gz",
193                 "https://github.com/bazelbuild/bazel-toolchains/archive/cddc376d428ada2927ad359211c3e356bd9c9fbb.tar.gz",
194             ],
195         )
196
197     if "bazel_skylib" not in native.existing_rules():
198         http_archive(
199             name = "bazel_skylib",
200             sha256 = "ba5d15ca230efca96320085d8e4d58da826d1f81b444ef8afccd8b23e0799b52",
201             strip_prefix = "bazel-skylib-f83cb8dd6f5658bc574ccd873e25197055265d1c",
202             url = "https://github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
203         )
204
205     if "io_opencensus_cpp" not in native.existing_rules():
206         http_archive(
207             name = "io_opencensus_cpp",
208             sha256 = "3436ca23dc1b3345186defd0f46d64244079ba3d3234a0c5d6ef5e8d5d06c8b5",
209             strip_prefix = "opencensus-cpp-9b1e354e89bf3d92aedc00af45b418ce870f3d77",
210             url = "https://github.com/census-instrumentation/opencensus-cpp/archive/9b1e354e89bf3d92aedc00af45b418ce870f3d77.tar.gz",
211         )
212
213     if "upb" not in native.existing_rules():
214         http_archive(
215             name = "upb",
216             sha256 = "0e749a8973968397f849a3b42e28ee9c85dc418c2477954c2a6a4495f323241d",
217             strip_prefix = "upb-ed9faae0993704b033c594b072d65e1bf19207fa",
218             url = "https://github.com/google/upb/archive/ed9faae0993704b033c594b072d65e1bf19207fa.tar.gz",
219         )
220
221 # TODO: move some dependencies from "grpc_deps" here?
222 def grpc_test_only_deps():
223     """Internal, not intended for use by packages that are consuming grpc.
224        Loads dependencies that are only needed to run grpc library's tests."""
225     native.bind(
226         name = "twisted",
227         actual = "@com_github_twisted_twisted//:twisted",
228     )
229
230     native.bind(
231         name = "yaml",
232         actual = "@com_github_yaml_pyyaml//:yaml",
233     )
234
235     if "com_github_twisted_twisted" not in native.existing_rules():
236         http_archive(
237             name = "com_github_twisted_twisted",
238             sha256 = "ca17699d0d62eafc5c28daf2c7d0a18e62ae77b4137300b6c7d7868b39b06139",
239             strip_prefix = "twisted-twisted-17.5.0",
240             url = "https://github.com/twisted/twisted/archive/twisted-17.5.0.zip",
241             build_file = "@com_github_grpc_grpc//third_party:twisted.BUILD",
242         )
243
244     if "com_github_yaml_pyyaml" not in native.existing_rules():
245         http_archive(
246             name = "com_github_yaml_pyyaml",
247             sha256 = "6b4314b1b2051ddb9d4fcd1634e1fa9c1bb4012954273c9ff3ef689f6ec6c93e",
248             strip_prefix = "pyyaml-3.12",
249             url = "https://github.com/yaml/pyyaml/archive/3.12.zip",
250             build_file = "@com_github_grpc_grpc//third_party:yaml.BUILD",
251         )
252
253     if "com_github_twisted_incremental" not in native.existing_rules():
254         http_archive(
255             name = "com_github_twisted_incremental",
256             sha256 = "f0ca93359ee70243ff7fbf2d904a6291810bd88cb80ed4aca6fa77f318a41a36",
257             strip_prefix = "incremental-incremental-17.5.0",
258             url = "https://github.com/twisted/incremental/archive/incremental-17.5.0.zip",
259             build_file = "@com_github_grpc_grpc//third_party:incremental.BUILD",
260         )
261
262     if "com_github_zopefoundation_zope_interface" not in native.existing_rules():
263         http_archive(
264             name = "com_github_zopefoundation_zope_interface",
265             sha256 = "e9579fc6149294339897be3aa9ecd8a29217c0b013fe6f44fcdae00e3204198a",
266             strip_prefix = "zope.interface-4.4.3",
267             url = "https://github.com/zopefoundation/zope.interface/archive/4.4.3.zip",
268             build_file = "@com_github_grpc_grpc//third_party:zope_interface.BUILD",
269         )
270
271     if "com_github_twisted_constantly" not in native.existing_rules():
272         http_archive(
273             name = "com_github_twisted_constantly",
274             sha256 = "2702cd322161a579d2c0dbf94af4e57712eedc7bd7bbbdc554a230544f7d346c",
275             strip_prefix = "constantly-15.1.0",
276             url = "https://github.com/twisted/constantly/archive/15.1.0.zip",
277             build_file = "@com_github_grpc_grpc//third_party:constantly.BUILD",
278         )