diff --git a/.bazelversion b/.bazelversion index 91ff5727..8a30e8f9 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -5.2.0 +5.4.0 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index a09aa7a6..951bc593 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -66,17 +66,10 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '^1.16' - - - name: Install dependencies - run: | - go install github.com/bazelbuild/buildtools/buildifier@latest - echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" - - name: Format (buildifier) - run: find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -n1 buildifier -mode=check + run: | + BAZEL_FILES="$(find . -name "WORKSPACE" -o -name "*BUILD*" -o -name "*.bzl" | xargs -I{} echo ${PWD}/{})" + bazel run @com_github_bazelbuild_buildtools//buildifier -- --mode=check "${BAZEL_FILES}" cargo_raze: name: check format with cargo-raze diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl index 49db6d7b..eb02514b 100644 --- a/bazel/dependencies.bzl +++ b/bazel/dependencies.bzl @@ -12,8 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains") load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies") load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign:crates.bzl", "wasmsign_fetch_remote_crates") load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime:crates.bzl", "wasmtime_fetch_remote_crates") load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") @@ -21,9 +23,14 @@ load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init") load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") load("@rules_python//python:pip.bzl", "pip_install") load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set") +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains") def proxy_wasm_cpp_host_dependencies(): # Bazel extensions. + go_rules_dependencies() + go_register_toolchains(version = "1.20.3") + + gazelle_dependencies() rules_foreign_cc_dependencies() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 89b0900e..ec9e62f6 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -19,6 +19,33 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def proxy_wasm_cpp_host_repositories(): # Bazel extensions. + maybe( + http_archive, + name = "io_bazel_rules_go", + sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", + ], + ) + maybe( + http_archive, + name = "bazel_gazelle", + sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", + ], + ) + + maybe( + http_archive, + name = "com_github_bazelbuild_buildtools", + urls = ["https://github.com/bazelbuild/buildtools/archive/v6.4.0.tar.gz"], + sha256 = "05c3c3602d25aeda1e9dbc91d3b66e624c1f9fdadf273e5480b489e744ca7269", + strip_prefix = "buildtools-6.4.0", + ) + maybe( http_archive, name = "bazel_skylib",