Skip to content

Commit 9ebc890

Browse files
deps: update bazel & bazel libs (scionproto#4426)
Drop the `go_embed_data` custom rules, those were deprecated for a long time. Drop most of the custom `rules_openapi` bazel rules. Users are recommended to use their own invocations of the JS tools.
1 parent 576fa43 commit 9ebc890

File tree

61 files changed

+3589
-3660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3589
-3660
lines changed

.bazelignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
bin
22
doc/_build
33
docker/_build
4-
rules_openapi/tools/node_modules
4+
private/mgmtapi/tools/node_modules
55
tools/lint/logctxcheck/testdata/src

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.4.0
1+
6.4.0

BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ load("//tools/lint:write_source_files.bzl", "write_source_files")
77
load("//tools/lint/python:flake8_config.bzl", "flake8_lint_config")
88
load("//:nogo.bzl", "nogo_deps")
99
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
10+
load("@npm//private/mgmtapi/tools:@stoplight/spectral-cli/package_json.bzl", spectral_bin = "bin")
1011

1112
# gazelle:prefix github.com/scionproto/scion
1213
# gazelle:map_kind go_library go_library //tools/lint:go.bzl
@@ -232,6 +233,10 @@ buildifier(
232233
mode = "check",
233234
)
234235

236+
spectral_bin.spectral_binary(
237+
name = "spectral",
238+
)
239+
235240
# Runs all write_source_files targets in this Workspace. To update the list run
236241
# bazel run @com_github_bazelbuild_buildtools//buildozer -- --root_dir $PWD "add additional_update_targets $( bazel query 'filter("^.*[^\d]$", kind(_write_source_file, //...)) except //:write_all_source_files' | tr '\n' ' ')" //:write_all_source_files
237242
write_source_files(

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ lint-openapi: lint-openapi-spectral
122122

123123
lint-openapi-spectral:
124124
$(info ==> $@)
125-
@tools/quiet bazel run --config=quiet @rules_openapi_npm//@stoplight/spectral-cli/bin:spectral -- lint --ruleset ${PWD}/spec/.spectral.yml ${PWD}/spec/*.gen.yml
125+
@tools/quiet bazel run --config=quiet //:spectral -- lint --ruleset ${PWD}/spec/.spectral.yml ${PWD}/spec/*.gen.yml
126126

127127
lint-doc: lint-doc-mdlint
128128

129129
lint-doc-mdlint:
130130
$(info ==> $@)
131-
@FILES=$$(find -type f -iname '*.md' -not -path "./rules_openapi/tools/node_modules/*" -not -path "./.github/**/*" | grep -vf tools/md/skipped); \
131+
@FILES=$$(find -type f -iname '*.md' -not -path "./private/mgmtapi/tools/node_modules/*" -not -path "./.github/**/*" | grep -vf tools/md/skipped); \
132132
docker run --rm -v ${PWD}:/data -v ${PWD}/tools/md/mdlintstyle.rb:/style.rb $$(docker build -q tools/md) $${FILES} -s /style.rb

WORKSPACE

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
workspace(
22
name = "com_github_scionproto_scion",
3-
managed_directories = {
4-
"@rules_openapi_npm": ["rules_openapi/tools/node_modules"],
5-
},
63
)
74

85
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
@@ -31,22 +28,28 @@ lint_setup({
3128

3229
http_archive(
3330
name = "aspect_bazel_lib",
34-
sha256 = "e3151d87910f69cf1fc88755392d7c878034a69d6499b287bcfc00b1cf9bb415",
35-
strip_prefix = "bazel-lib-1.32.1",
36-
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.32.1.tar.gz",
31+
sha256 = "a185ccff9c1b8589c63f66d7eb908de15c5d6bb05562be5f46336c53e7a7326a",
32+
strip_prefix = "bazel-lib-2.0.0-rc1",
33+
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.0.0-rc1/bazel-lib-v2.0.0-rc1.tar.gz",
3734
)
3835

39-
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
36+
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
37+
38+
# Required bazel-lib dependencies
4039

4140
aspect_bazel_lib_dependencies()
4241

42+
# Register bazel-lib toolchains
43+
44+
aspect_bazel_lib_register_toolchains()
45+
4346
# Bazel rules for Golang
4447
http_archive(
4548
name = "io_bazel_rules_go",
46-
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
49+
sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
4750
urls = [
48-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
49-
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
51+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
52+
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
5053
],
5154
)
5255

@@ -60,28 +63,14 @@ go_register_toolchains(
6063
# Gazelle
6164
http_archive(
6265
name = "bazel_gazelle",
63-
sha256 = "29218f8e0cebe583643cbf93cae6f971be8a2484cdcfa1e45057658df8d54002",
66+
sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
6467
urls = [
65-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.32.0/bazel-gazelle-v0.32.0.tar.gz",
66-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.32.0/bazel-gazelle-v0.32.0.tar.gz",
68+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
69+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
6770
],
6871
)
6972

70-
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
71-
72-
# Explictly override golang.org/x/sys. Our github.com/quic-go/quic-go cannot
73-
# compile without at least golang.org/x/[email protected]. The rules_go version that
74-
# we use (v0.34.0) imports an older version. A recent enough version was only introduced
75-
# in v0.36.0. See: https://github.com/bazelbuild/rules_go/commit/64b9226a3bca997866b8831889ffb9de87405a0d
76-
#
77-
# This version should be kept in sync with the go_deps.bzl file. We can remove it
78-
# once we update the rules_go version.
79-
go_repository(
80-
name = "org_golang_x_sys",
81-
importpath = "golang.org/x/sys",
82-
sum = "h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=",
83-
version = "v0.8.0",
84-
)
73+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
8574

8675
go_rules_dependencies()
8776

@@ -94,26 +83,20 @@ load("//:go_deps.bzl", "go_deps")
9483

9584
go_deps()
9685

97-
## Explictly override xerrors: https://github.com/bazelbuild/bazel-gazelle/issues/1217
98-
# go_repository(
99-
# name = "org_golang_x_xerrors",
100-
# importpath = "golang.org/x/xerrors",
101-
# sum = "h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=",
102-
# version = "v0.0.0-20220907171357-04be3eba64a2",
103-
# )
104-
10586
gazelle_dependencies()
10687

10788
# XXX Needs to be before rules_docker
10889
# Python rules
10990
http_archive(
11091
name = "rules_python",
111-
sha256 = "8c8fe44ef0a9afc256d1e75ad5f448bb59b81aba149b8958f02f7b3a98f5d9b4",
112-
strip_prefix = "rules_python-0.13.0",
113-
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.13.0.tar.gz",
92+
sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
93+
strip_prefix = "rules_python-0.26.0",
94+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
11495
)
11596

116-
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
97+
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
98+
99+
py_repositories()
117100

118101
python_register_toolchains(
119102
name = "python3_10",
@@ -131,10 +114,10 @@ install_python_deps()
131114

132115
http_archive(
133116
name = "rules_pkg",
134-
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
117+
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
135118
urls = [
136-
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
137-
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
119+
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
120+
"https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
138121
],
139122
)
140123

@@ -158,9 +141,8 @@ rules_antlr_dependencies("4.9.3")
158141

159142
http_archive(
160143
name = "io_bazel_rules_docker",
161-
sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
162-
strip_prefix = "rules_docker-0.23.0",
163-
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
144+
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
145+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
164146
)
165147

166148
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
@@ -241,9 +223,9 @@ container_pull(
241223
# protobuf/gRPC
242224
http_archive(
243225
name = "rules_proto_grpc",
244-
sha256 = "7954abbb6898830cd10ac9714fbcacf092299fda00ed2baf781172f545120419",
245-
strip_prefix = "rules_proto_grpc-3.1.1",
246-
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/3.1.1.tar.gz"],
226+
sha256 = "9ba7299c5eb6ec45b6b9a0ceb9916d0ab96789ac8218269322f0124c0c0d24e2",
227+
strip_prefix = "rules_proto_grpc-4.5.0",
228+
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/4.5.0/rules_proto_grpc-4.5.0.tar.gz"],
247229
)
248230

249231
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
@@ -258,18 +240,16 @@ rules_proto_dependencies()
258240

259241
rules_proto_toolchains()
260242

261-
load("@rules_proto_grpc//python:repositories.bzl", rules_proto_grpc_python_repos = "python_repos")
262-
263-
rules_proto_grpc_python_repos()
243+
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")
264244

265-
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
266-
267-
grpc_deps()
245+
rules_proto_grpc_buf_repos()
268246

269247
http_archive(
270248
name = "com_github_bazelbuild_buildtools",
271-
strip_prefix = "buildtools-master",
272-
url = "https://github.com/bazelbuild/buildtools/archive/2.2.1.zip",
249+
strip_prefix = "buildtools-6.3.3",
250+
urls = [
251+
"https://github.com/bazelbuild/buildtools/archive/refs/tags/6.3.3.tar.gz",
252+
],
273253
)
274254

275255
http_file(
@@ -290,10 +270,32 @@ load("@com_github_scionproto_scion_python_lint_deps//:requirements.bzl", install
290270

291271
install_python_lint_deps()
292272

293-
load("//rules_openapi:dependencies.bzl", "rules_openapi_dependencies")
273+
http_archive(
274+
name = "aspect_rules_js",
275+
sha256 = "a949d56fed8fa0a8dd82a0a660acc949253a05b2b0c52a07e4034e27f11218f6",
276+
strip_prefix = "rules_js-1.33.1",
277+
url = "https://github.com/aspect-build/rules_js/releases/download/v1.33.1/rules_js-v1.33.1.tar.gz",
278+
)
279+
280+
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
281+
282+
rules_js_dependencies()
294283

295-
rules_openapi_dependencies()
284+
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
285+
286+
nodejs_register_toolchains(
287+
name = "nodejs",
288+
node_version = DEFAULT_NODE_VERSION,
289+
)
290+
291+
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
292+
293+
npm_translate_lock(
294+
name = "npm",
295+
pnpm_lock = "@com_github_scionproto_scion//private/mgmtapi/tools:pnpm-lock.yaml",
296+
verify_node_modules_ignored = "@com_github_scionproto_scion//:.bazelignore",
297+
)
296298

297-
load("//rules_openapi:install.bzl", "rules_openapi_install_yarn_dependencies")
299+
load("@npm//:repositories.bzl", "npm_repositories")
298300

299-
rules_openapi_install_yarn_dependencies()
301+
npm_repositories()

control/mgmtapi/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
load("//tools/lint:go.bzl", "go_library", "go_test")
2-
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
3-
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
2+
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")
43

5-
openapi_build_docs(
4+
openapi_docs(
65
name = "doc",
76
src = "//spec:control",
87
out = "index.html",

daemon/mgmtapi/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
load("//tools/lint:go.bzl", "go_library")
2-
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
3-
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
2+
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")
43

5-
openapi_build_docs(
4+
openapi_docs(
65
name = "doc",
76
src = "//spec:daemon",
87
out = "index.html",

dispatcher/mgmtapi/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
load("//tools/lint:go.bzl", "go_library")
2-
load("//rules_openapi:defs.bzl", "openapi_build_docs")
3-
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
2+
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")
43

5-
openapi_build_docs(
4+
openapi_docs(
65
name = "doc",
76
src = "//spec:dispatcher",
87
out = "index.html",

gateway/mgmtapi/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
load("//tools/lint:go.bzl", "go_library")
2-
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
3-
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
2+
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")
43

5-
openapi_build_docs(
4+
openapi_docs(
65
name = "doc",
76
src = "//spec:gateway",
87
out = "index.html",

licenses/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")
22

33
pkg_tar(
44
name = "licenses",
5-
srcs = ["data"],
5+
srcs = glob(["data/**/*"]),
66
package_dir = "/licenses",
77
strip_prefix = "data",
88
visibility = ["//visibility:public"],
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
Copyright Jason R. Coombs
1+
MIT License
2+
3+
Copyright (c) 2019 Yibo Cai
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy
4-
of this software and associated documentation files (the "Software"), to
5-
deal in the Software without restriction, including without limitation the
6-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7-
sell copies of the Software, and to permit persons to whom the Software is
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
810
furnished to do so, subject to the following conditions:
911

10-
The above copyright notice and this permission notice shall be included in
11-
all copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
1214

1315
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1416
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1517
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1618
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19-
IN THE SOFTWARE.
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

licenses/data/com_google_protobuf/third_party/wyhash/LICENSE

Lines changed: 0 additions & 25 deletions
This file was deleted.

licenses/data/org_golang_x_sys/LICENSE

100644100755
File mode changed.

0 commit comments

Comments
 (0)