1# Copyright 2017 The Bazel Authors. All rights reserved.
2#
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
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
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.
14
15load(
16 "@bazel_tools//tools/build_defs/repo:http.bzl",
17 "http_archive",
18)
19load(
20 "//internal:go_repository.bzl",
21 _go_repository = "go_repository",
22)
23load(
24 "//internal:go_repository_cache.bzl",
25 "go_repository_cache",
26)
27load(
28 "//internal:go_repository_config.bzl",
29 "go_repository_config",
30)
31load(
32 "//internal:go_repository_tools.bzl",
33 "go_repository_tools",
34)
35load(
36 "//internal:is_bazel_module.bzl",
37 "is_bazel_module",
38)
39
40# Re-export go_repository . Users should get it from this file.
41go_repository = _go_repository
42
43def gazelle_dependencies(
44 go_sdk = "",
45 go_repository_default_config = "@//:WORKSPACE",
46 go_env = {}):
47 _maybe(
48 http_archive,
49 name = "bazel_skylib",
50 urls = [
51 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
52 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
53 ],
54 sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
55 )
56
57 if go_sdk:
58 go_repository_cache(
59 name = "bazel_gazelle_go_repository_cache",
60 go_sdk_name = go_sdk,
61 go_env = go_env,
62 )
63 else:
64 go_sdk_info = {}
65 for name, r in native.existing_rules().items():
66 # match internal rule names but don't reference them directly.
67 # New rules may be added in the future, and they might be
68 # renamed (_go_download_sdk => go_download_sdk).
69 if name != "go_sdk" and ("go_" not in r["kind"] or "_sdk" not in r["kind"]):
70 continue
71 if r.get("goos", "") and r.get("goarch", ""):
72 platform = r["goos"] + "_" + r["goarch"]
73 else:
74 platform = "host"
75 go_sdk_info[name] = platform
76 go_repository_cache(
77 name = "bazel_gazelle_go_repository_cache",
78 go_sdk_info = go_sdk_info,
79 go_env = go_env,
80 )
81
82 go_repository_tools(
83 name = "bazel_gazelle_go_repository_tools",
84 go_cache = "@bazel_gazelle_go_repository_cache//:go.env",
85 )
86
87 go_repository_config(
88 name = "bazel_gazelle_go_repository_config",
89 config = go_repository_default_config,
90 )
91
92 is_bazel_module(
93 name = "bazel_gazelle_is_bazel_module",
94 is_bazel_module = False,
95 )
96 _maybe(
97 go_repository,
98 name = "co_honnef_go_tools",
99 importpath = "honnef.co/go/tools",
100 sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=",
101 version = "v0.0.0-20190523083050-ea95bdfd59fc",
102 )
103 _maybe(
104 go_repository,
105 name = "com_github_bazelbuild_buildtools",
106 importpath = "github.com/bazelbuild/buildtools",
107 sum = "h1:VNqmvOfFzn2Hrtoni8vqgXlIQ4C2Zt22fxeZ9gOOkp0=",
108 version = "v0.0.0-20240313121412-66c605173954",
109 )
110 _maybe(
111 go_repository,
112 name = "com_github_bazelbuild_rules_go",
113 importpath = "github.com/bazelbuild/rules_go",
114 sum = "h1:CTefzjN/D3Cdn3rkrM6qMWuQj59OBcuOjyIp3m4hZ7s=",
115 version = "v0.46.0",
116 )
117 _maybe(
118 go_repository,
119 name = "com_github_bmatcuk_doublestar_v4",
120 importpath = "github.com/bmatcuk/doublestar/v4",
121 sum = "h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=",
122 version = "v4.6.1",
123 )
124 _maybe(
125 go_repository,
126 name = "com_github_burntsushi_toml",
127 importpath = "github.com/BurntSushi/toml",
128 sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=",
129 version = "v0.3.1",
130 )
131 _maybe(
132 go_repository,
133 name = "com_github_census_instrumentation_opencensus_proto",
134 importpath = "github.com/census-instrumentation/opencensus-proto",
135 sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=",
136 version = "v0.2.1",
137 )
138 _maybe(
139 go_repository,
140 name = "com_github_chzyer_logex",
141 importpath = "github.com/chzyer/logex",
142 sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=",
143 version = "v1.1.10",
144 )
145 _maybe(
146 go_repository,
147 name = "com_github_chzyer_readline",
148 importpath = "github.com/chzyer/readline",
149 sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=",
150 version = "v0.0.0-20180603132655-2972be24d48e",
151 )
152 _maybe(
153 go_repository,
154 name = "com_github_chzyer_test",
155 importpath = "github.com/chzyer/test",
156 sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=",
157 version = "v0.0.0-20180213035817-a1ea475d72b1",
158 )
159 _maybe(
160 go_repository,
161 name = "com_github_client9_misspell",
162 importpath = "github.com/client9/misspell",
163 sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=",
164 version = "v0.3.4",
165 )
166 _maybe(
167 go_repository,
168 name = "com_github_envoyproxy_go_control_plane",
169 importpath = "github.com/envoyproxy/go-control-plane",
170 sum = "h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=",
171 version = "v0.9.1-0.20191026205805-5f8ba28d4473",
172 )
173 _maybe(
174 go_repository,
175 name = "com_github_envoyproxy_protoc_gen_validate",
176 importpath = "github.com/envoyproxy/protoc-gen-validate",
177 sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=",
178 version = "v0.1.0",
179 )
180 _maybe(
181 go_repository,
182 name = "com_github_fsnotify_fsnotify",
183 importpath = "github.com/fsnotify/fsnotify",
184 sum = "h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=",
185 version = "v1.7.0",
186 )
187 _maybe(
188 go_repository,
189 name = "com_github_gogo_protobuf",
190 importpath = "github.com/gogo/protobuf",
191 sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=",
192 version = "v1.3.2",
193 )
194 _maybe(
195 go_repository,
196 name = "com_github_golang_glog",
197 importpath = "github.com/golang/glog",
198 sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=",
199 version = "v0.0.0-20160126235308-23def4e6c14b",
200 )
201 _maybe(
202 go_repository,
203 name = "com_github_golang_mock",
204 importpath = "github.com/golang/mock",
205 sum = "h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U=",
206 version = "v1.7.0-rc.1",
207 )
208 _maybe(
209 go_repository,
210 name = "com_github_golang_protobuf",
211 importpath = "github.com/golang/protobuf",
212 sum = "h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=",
213 version = "v1.5.3",
214 )
215 _maybe(
216 go_repository,
217 name = "com_github_google_go_cmp",
218 importpath = "github.com/google/go-cmp",
219 sum = "h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=",
220 version = "v0.6.0",
221 )
222 _maybe(
223 go_repository,
224 name = "com_github_pmezard_go_difflib",
225 importpath = "github.com/pmezard/go-difflib",
226 sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
227 version = "v1.0.0",
228 )
229 _maybe(
230 go_repository,
231 name = "com_github_prometheus_client_model",
232 importpath = "github.com/prometheus/client_model",
233 sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=",
234 version = "v0.0.0-20190812154241-14fe0d1b01d4",
235 )
236 _maybe(
237 go_repository,
238 name = "com_google_cloud_go",
239 importpath = "cloud.google.com/go",
240 sum = "h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=",
241 version = "v0.26.0",
242 )
243 _maybe(
244 go_repository,
245 name = "net_starlark_go",
246 importpath = "go.starlark.net",
247 sum = "h1:xwwDQW5We85NaTk2APgoN9202w/l0DVGp+GZMfsrh7s=",
248 version = "v0.0.0-20210223155950-e043a3d3c984",
249 )
250 _maybe(
251 go_repository,
252 name = "org_golang_google_appengine",
253 importpath = "google.golang.org/appengine",
254 sum = "h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=",
255 version = "v1.4.0",
256 )
257 _maybe(
258 go_repository,
259 name = "org_golang_google_genproto",
260 importpath = "google.golang.org/genproto",
261 sum = "h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=",
262 version = "v0.0.0-20200526211855-cb27e3aa2013",
263 )
264 _maybe(
265 go_repository,
266 name = "org_golang_google_grpc",
267 importpath = "google.golang.org/grpc",
268 sum = "h1:pnP7OclFFFgFi4VHQDQDaoXUVauOFyktqTsqqgzFKbc=",
269 version = "v1.40.1",
270 )
271 _maybe(
272 go_repository,
273 name = "org_golang_google_grpc_cmd_protoc_gen_go_grpc",
274 importpath = "google.golang.org/grpc/cmd/protoc-gen-go-grpc",
275 sum = "h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=",
276 version = "v1.3.0",
277 )
278 _maybe(
279 go_repository,
280 name = "org_golang_google_protobuf",
281 importpath = "google.golang.org/protobuf",
282 sum = "h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=",
283 version = "v1.31.0",
284 )
285 _maybe(
286 go_repository,
287 name = "org_golang_x_crypto",
288 importpath = "golang.org/x/crypto",
289 sum = "h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=",
290 version = "v0.0.0-20190308221718-c2843e01d9a2",
291 )
292 _maybe(
293 go_repository,
294 name = "org_golang_x_exp",
295 importpath = "golang.org/x/exp",
296 sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=",
297 version = "v0.0.0-20190121172915-509febef88a4",
298 )
299 _maybe(
300 go_repository,
301 name = "org_golang_x_lint",
302 importpath = "golang.org/x/lint",
303 sum = "h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=",
304 version = "v0.0.0-20190313153728-d0100b6bd8b3",
305 )
306 _maybe(
307 go_repository,
308 name = "org_golang_x_mod",
309 importpath = "golang.org/x/mod",
310 sum = "h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=",
311 version = "v0.16.0",
312 )
313 _maybe(
314 go_repository,
315 name = "org_golang_x_net",
316 importpath = "golang.org/x/net",
317 sum = "h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=",
318 version = "v0.18.0",
319 )
320 _maybe(
321 go_repository,
322 name = "org_golang_x_oauth2",
323 importpath = "golang.org/x/oauth2",
324 sum = "h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=",
325 version = "v0.0.0-20180821212333-d2e6202438be",
326 )
327 _maybe(
328 go_repository,
329 name = "org_golang_x_sync",
330 importpath = "golang.org/x/sync",
331 sum = "h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=",
332 version = "v0.6.0",
333 )
334 _maybe(
335 go_repository,
336 name = "org_golang_x_sys",
337 importpath = "golang.org/x/sys",
338 sum = "h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=",
339 version = "v0.18.0",
340 )
341 _maybe(
342 go_repository,
343 name = "org_golang_x_text",
344 importpath = "golang.org/x/text",
345 sum = "h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=",
346 version = "v0.14.0",
347 )
348 _maybe(
349 go_repository,
350 name = "org_golang_x_tools",
351 importpath = "golang.org/x/tools",
352 sum = "h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=",
353 version = "v0.15.0",
354 )
355 _maybe(
356 go_repository,
357 name = "org_golang_x_tools_go_vcs",
358 importpath = "golang.org/x/tools/go/vcs",
359 sum = "h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4=",
360 version = "v0.1.0-deprecated",
361 )
362 _maybe(
363 go_repository,
364 name = "org_golang_x_xerrors",
365 importpath = "golang.org/x/xerrors",
366 sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
367 version = "v0.0.0-20200804184101-5ec99f83aff1",
368 )
369
370def _maybe(repo_rule, name, **kwargs):
371 if name not in native.existing_rules():
372 repo_rule(name = name, **kwargs)
View as plain text