Skip to content

Commit e800153

Browse files
authored
Fix Bazel buildtools dependency (#4980)
* Fix Bazel module dependencies * Import bazelbuild manually instead of through Gazelle
1 parent 5076a6b commit e800153

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

MODULE.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ use_repo(
6060
"org_golang_x_oauth2",
6161
"org_golang_x_text",
6262
)
63+
64+
non_module_deps = use_extension(":non_module_deps.bzl", "non_module_deps")
65+
use_repo(
66+
non_module_deps,
67+
"com_github_bazelbuild_buildtools",
68+
"org_golang_x_tools",
69+
)

MODULE.bazel.lock

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

non_module_deps.bzl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Module extension for non-module dependencies."""
2+
3+
load("@bazel_gazelle//:deps.bzl", "go_repository")
4+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5+
6+
def _non_module_deps_impl(
7+
# buildifier: disable=unused-variable
8+
mctx):
9+
# TODO(bazelbuild/buildtools#1204): Remove when available as module.
10+
go_repository(
11+
name = "org_golang_x_tools",
12+
importpath = "golang.org/x/tools",
13+
sum = "h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=",
14+
version = "v0.21.1-0.20240508182429-e35e4ccd0d2d",
15+
)
16+
http_archive(
17+
name = "com_github_bazelbuild_buildtools",
18+
sha256 = "42968f9134ba2c75c03bb271bd7bb062afb7da449f9b913c96e5be4ce890030a",
19+
strip_prefix = "buildtools-6.3.3",
20+
urls = ["https://github.com/bazelbuild/buildtools/archive/v6.3.3.tar.gz"],
21+
)
22+
23+
non_module_deps = module_extension(
24+
implementation = _non_module_deps_impl,
25+
)

0 commit comments

Comments
 (0)