Skip to content

Commit 350db17

Browse files
author
Jaden Peterson
committed
Use buildifier-prebuilt instead of building buildifier
It's my goal to remove `dev_deps`, and switching to `buildifier-prebuilt` gets us one step closer to doing that. It should also make CI faster.
1 parent 4f68cc1 commit 350db17

File tree

5 files changed

+21
-103
lines changed

5 files changed

+21
-103
lines changed

MODULE.bazel

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ internal_dev_deps = use_extension(
195195
# See //scala/private:extensions/dev_deps.bzl for notes on some of these repos.
196196
use_repo(
197197
internal_dev_deps,
198-
"com_github_bazelbuild_buildtools",
199198
"com_github_jnr_jffi_native",
200199
"com_google_guava_guava_21_0",
201200
"com_google_guava_guava_21_0_with_file",
@@ -255,54 +254,6 @@ bazel_dep(
255254
dev_dependency = True,
256255
repo_name = "bazelci_rules",
257256
)
258-
bazel_dep(
259-
name = "rules_go",
260-
version = "0.58.2",
261-
dev_dependency = True,
262-
repo_name = "io_bazel_rules_go", # for com_github_bazelbuild_buildtools
263-
)
264-
bazel_dep(name = "gazelle", version = "0.45.0", dev_dependency = True)
265-
266-
go_sdk = use_extension(
267-
"@io_bazel_rules_go//go:extensions.bzl",
268-
"go_sdk",
269-
dev_dependency = True,
270-
)
271-
go_sdk.download(version = "1.25.3")
272-
273-
go_deps = use_extension(
274-
"@gazelle//:extensions.bzl",
275-
"go_deps",
276-
dev_dependency = True,
277-
)
278-
279-
# The go_deps.module calls are inspired by the following to get the
280-
# com_github_bazelbuild_buildtools repo to work:
281-
#
282-
# - https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/gazelle/0.39.1/MODULE.bazel#L31-L57
283-
#
284-
# To get the latest version and hashes for each per:
285-
#
286-
# - https://go.dev/ref/mod#go-list-m
287-
# - https://go.dev/ref/mod#checksum-database
288-
#
289-
# go list -m golang.org/x/tools@latest
290-
# curl https://sum.golang.org/lookup/golang.org/x/tools@v0.38.0
291-
go_deps.module(
292-
path = "golang.org/x/tools",
293-
sum = "h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=",
294-
version = "v0.38.0",
295-
)
296-
go_deps.module(
297-
path = "github.com/golang/protobuf",
298-
sum = "h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=",
299-
version = "v1.5.4",
300-
)
301-
use_repo(
302-
go_deps,
303-
"com_github_golang_protobuf",
304-
"org_golang_x_tools",
305-
)
306-
257+
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2", dev_dependency = True)
307258
bazel_dep(name = "rules_python", version = "1.6.3", dev_dependency = True)
308259
bazel_dep(name = "rules_shell", version = "0.6.1", dev_dependency = True)

MODULE.bazel.lock

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

WORKSPACE

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,6 @@ local_repository(
104104
path = "third_party/test/example_external_workspace",
105105
)
106106

107-
http_archive(
108-
name = "io_bazel_rules_go",
109-
sha256 = "54bbb67a4196170cc60ef3b52a2747ad1759cba4764b4c4752b744080ad99947",
110-
urls = [
111-
"https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.58.2/rules_go-v0.58.2.zip",
112-
"https://github.com/bazel-contrib/rules_go/releases/download/v0.58.2/rules_go-v0.58.2.zip",
113-
],
114-
)
115-
116-
load(
117-
"@io_bazel_rules_go//go:deps.bzl",
118-
"go_register_toolchains",
119-
"go_rules_dependencies",
120-
)
121-
122-
go_rules_dependencies()
123-
124-
go_register_toolchains(version = "1.25.3")
125-
126107
http_archive(
127108
name = "bazelci_rules",
128109
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
@@ -132,6 +113,23 @@ http_archive(
132113

133114
load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
134115

116+
buildifier_prebuilt_version = "8.2.0.2"
117+
118+
http_archive(
119+
name = "buildifier_prebuilt",
120+
sha256 = "f98dd3d8f32661629b8cab11f02d7730bb8e03bd8af09dbbb268047889c8ff10",
121+
strip_prefix = "buildifier-prebuilt-{}".format(buildifier_prebuilt_version),
122+
urls = ["http://github.com/keith/buildifier-prebuilt/archive/{}.tar.gz".format(buildifier_prebuilt_version)],
123+
)
124+
125+
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")
126+
127+
buildifier_prebuilt_deps()
128+
129+
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")
130+
131+
buildifier_prebuilt_register_toolchains()
132+
135133
rbe_preconfig(
136134
name = "rbe_default",
137135
toolchain = "ubuntu2004-bazel-java11",

scala/private/extensions/dev_deps.bzl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ def dev_deps_repositories(
4343
fetch_sources: retrieve Maven artifact sources when True
4444
"""
4545

46-
# gazelle is still getting `buildtools` from its `go.mod` file, which breaks
47-
# `bazel run //tools:lint_check` when we don't import it like this. See:
48-
# - https://github.com/bazel-contrib/bazel-gazelle/blob/v0.43.0/MODULE.bazel#L32-L44
49-
http_archive(
50-
name = "com_github_bazelbuild_buildtools",
51-
integrity = _BUILD_TOOLS_INTEGRITY,
52-
strip_prefix = "buildtools-%s" % _BUILD_TOOLS_RELEASE,
53-
url = (
54-
"https://github.com/bazelbuild/buildtools/archive/v%s.tar.gz" %
55-
_BUILD_TOOLS_RELEASE
56-
),
57-
)
58-
5946
# bazel's java_import_external has been altered in rules_scala to be a macro
6047
# based on jvm_import_external in order to allow for other jvm-language
6148
# imports (e.g. scala_import) the 3rd-party dependency below is using the

tools/BUILD

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
load(
2-
"@com_github_bazelbuild_buildtools//buildifier:def.bzl",
3-
"buildifier",
4-
"buildifier_test",
5-
)
1+
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
62

73
WARNINGS_CONFIG = [
84
"-module-docstring",

0 commit comments

Comments
 (0)