Skip to content

Commit

Permalink
deps: update bazel & bazel libs (scionproto#4426)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukedirtwalker authored and juagargi committed Mar 8, 2024
1 parent bd675dd commit f571c58
Show file tree
Hide file tree
Showing 61 changed files with 3,589 additions and 3,660 deletions.
2 changes: 1 addition & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin
doc/_build
docker/_build
rules_openapi/tools/node_modules
private/mgmtapi/tools/node_modules
tools/lint/logctxcheck/testdata/src
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.0
6.4.0
5 changes: 5 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ load("//tools/lint:write_source_files.bzl", "write_source_files")
load("//tools/lint/python:flake8_config.bzl", "flake8_lint_config")
load("//:nogo.bzl", "nogo_deps")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@npm//private/mgmtapi/tools:@stoplight/spectral-cli/package_json.bzl", spectral_bin = "bin")

# gazelle:prefix github.com/scionproto/scion
# gazelle:map_kind go_library go_library //tools/lint:go.bzl
Expand Down Expand Up @@ -232,6 +233,10 @@ buildifier(
mode = "check",
)

spectral_bin.spectral_binary(
name = "spectral",
)

# Runs all write_source_files targets in this Workspace. To update the list run
# 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
write_source_files(
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ lint-openapi: lint-openapi-spectral

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

lint-doc: lint-doc-mdlint

lint-doc-mdlint:
$(info ==> $@)
@FILES=$$(find -type f -iname '*.md' -not -path "./rules_openapi/tools/node_modules/*" -not -path "./.github/**/*" | grep -vf tools/md/skipped); \
@FILES=$$(find -type f -iname '*.md' -not -path "./private/mgmtapi/tools/node_modules/*" -not -path "./.github/**/*" | grep -vf tools/md/skipped); \
docker run --rm -v ${PWD}:/data -v ${PWD}/tools/md/mdlintstyle.rb:/style.rb $$(docker build -q tools/md) $${FILES} -s /style.rb
124 changes: 63 additions & 61 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
workspace(
name = "com_github_scionproto_scion",
managed_directories = {
"@rules_openapi_npm": ["rules_openapi/tools/node_modules"],
},
)

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

http_archive(
name = "aspect_bazel_lib",
sha256 = "e3151d87910f69cf1fc88755392d7c878034a69d6499b287bcfc00b1cf9bb415",
strip_prefix = "bazel-lib-1.32.1",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.32.1.tar.gz",
sha256 = "a185ccff9c1b8589c63f66d7eb908de15c5d6bb05562be5f46336c53e7a7326a",
strip_prefix = "bazel-lib-2.0.0-rc1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.0.0-rc1/bazel-lib-v2.0.0-rc1.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")

# Required bazel-lib dependencies

aspect_bazel_lib_dependencies()

# Register bazel-lib toolchains

aspect_bazel_lib_register_toolchains()

# Bazel rules for Golang
http_archive(
name = "io_bazel_rules_go",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
],
)

Expand All @@ -60,28 +63,14 @@ go_register_toolchains(
# Gazelle
http_archive(
name = "bazel_gazelle",
sha256 = "29218f8e0cebe583643cbf93cae6f971be8a2484cdcfa1e45057658df8d54002",
sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.32.0/bazel-gazelle-v0.32.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.32.0/bazel-gazelle-v0.32.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
],
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

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

go_rules_dependencies()

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

go_deps()

## Explictly override xerrors: https://github.com/bazelbuild/bazel-gazelle/issues/1217
# go_repository(
# name = "org_golang_x_xerrors",
# importpath = "golang.org/x/xerrors",
# sum = "h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=",
# version = "v0.0.0-20220907171357-04be3eba64a2",
# )

gazelle_dependencies()

# XXX Needs to be before rules_docker
# Python rules
http_archive(
name = "rules_python",
sha256 = "8c8fe44ef0a9afc256d1e75ad5f448bb59b81aba149b8958f02f7b3a98f5d9b4",
strip_prefix = "rules_python-0.13.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.13.0.tar.gz",
sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
strip_prefix = "rules_python-0.26.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "python_register_toolchains")
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")

py_repositories()

python_register_toolchains(
name = "python3_10",
Expand All @@ -131,10 +114,10 @@ install_python_deps()

http_archive(
name = "rules_pkg",
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
],
)

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

http_archive(
name = "io_bazel_rules_docker",
sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
strip_prefix = "rules_docker-0.23.0",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)

load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
Expand Down Expand Up @@ -241,9 +223,9 @@ container_pull(
# protobuf/gRPC
http_archive(
name = "rules_proto_grpc",
sha256 = "7954abbb6898830cd10ac9714fbcacf092299fda00ed2baf781172f545120419",
strip_prefix = "rules_proto_grpc-3.1.1",
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/3.1.1.tar.gz"],
sha256 = "9ba7299c5eb6ec45b6b9a0ceb9916d0ab96789ac8218269322f0124c0c0d24e2",
strip_prefix = "rules_proto_grpc-4.5.0",
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/4.5.0/rules_proto_grpc-4.5.0.tar.gz"],
)

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

rules_proto_toolchains()

load("@rules_proto_grpc//python:repositories.bzl", rules_proto_grpc_python_repos = "python_repos")

rules_proto_grpc_python_repos()
load("@rules_proto_grpc//buf:repositories.bzl", rules_proto_grpc_buf_repos = "buf_repos")

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()
rules_proto_grpc_buf_repos()

http_archive(
name = "com_github_bazelbuild_buildtools",
strip_prefix = "buildtools-master",
url = "https://github.com/bazelbuild/buildtools/archive/2.2.1.zip",
strip_prefix = "buildtools-6.3.3",
urls = [
"https://github.com/bazelbuild/buildtools/archive/refs/tags/6.3.3.tar.gz",
],
)

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

install_python_lint_deps()

load("//rules_openapi:dependencies.bzl", "rules_openapi_dependencies")
http_archive(
name = "aspect_rules_js",
sha256 = "a949d56fed8fa0a8dd82a0a660acc949253a05b2b0c52a07e4034e27f11218f6",
strip_prefix = "rules_js-1.33.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.33.1/rules_js-v1.33.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

rules_openapi_dependencies()
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
pnpm_lock = "@com_github_scionproto_scion//private/mgmtapi/tools:pnpm-lock.yaml",
verify_node_modules_ignored = "@com_github_scionproto_scion//:.bazelignore",
)

load("//rules_openapi:install.bzl", "rules_openapi_install_yarn_dependencies")
load("@npm//:repositories.bzl", "npm_repositories")

rules_openapi_install_yarn_dependencies()
npm_repositories()
5 changes: 2 additions & 3 deletions control/mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("//tools/lint:go.bzl", "go_library", "go_test")
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")

openapi_build_docs(
openapi_docs(
name = "doc",
src = "//spec:control",
out = "index.html",
Expand Down
5 changes: 2 additions & 3 deletions daemon/mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("//tools/lint:go.bzl", "go_library")
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")

openapi_build_docs(
openapi_docs(
name = "doc",
src = "//spec:daemon",
out = "index.html",
Expand Down
5 changes: 2 additions & 3 deletions dispatcher/mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("//tools/lint:go.bzl", "go_library")
load("//rules_openapi:defs.bzl", "openapi_build_docs")
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")

openapi_build_docs(
openapi_docs(
name = "doc",
src = "//spec:dispatcher",
out = "index.html",
Expand Down
5 changes: 2 additions & 3 deletions gateway/mgmtapi/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
load("//tools/lint:go.bzl", "go_library")
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_build_docs")
load("//private/mgmtapi:api.bzl", "openapi_generate_go")
load("//private/mgmtapi:api.bzl", "openapi_docs", "openapi_generate_go")

openapi_build_docs(
openapi_docs(
name = "doc",
src = "//spec:gateway",
out = "index.html",
Expand Down
2 changes: 1 addition & 1 deletion licenses/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
name = "licenses",
srcs = ["data"],
srcs = glob(["data/**/*"]),
package_dir = "/licenses",
strip_prefix = "data",
visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
Copyright Jason R. Coombs
MIT License

Copyright (c) 2019 Yibo Cai

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

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 0 additions & 25 deletions licenses/data/com_google_protobuf/third_party/wyhash/LICENSE

This file was deleted.

Empty file modified licenses/data/org_golang_x_sys/LICENSE
100644 → 100755
Empty file.
Loading

0 comments on commit f571c58

Please sign in to comment.