Skip to content

Commit

Permalink
chore: bump to Bazel 7 (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Apr 28, 2024
1 parent ca06ab9 commit 918e4eb
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/5.7.2
USE_BAZEL_VERSION=aspect/5.9.25
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
6.3.2
7.1.1
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# TODO(alex): add testing on Bazel 7
- id: bazel_6
- id: bazel_7
run: echo "bazelversion=$(head -n 1 .bazelversion)" >> $GITHUB_OUTPUT
outputs:
# Will look like ["<version from .bazelversion>", ...]
Expand Down
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ dist
node_modules
.DS_Store
aspect-build-webpack-*
.bazelrc.user
.bazelrc.user

# Don't commit lockfile for now as it is unstable. Do allow for it to be
# created, however, since it gives a performance boost for local development.
# https://github.com/bazelbuild/bazel/issues/19026
# https://github.com/bazelbuild/bazel/issues/19621
# https://github.com/bazelbuild/bazel/issues/19971
# https://github.com/bazelbuild/bazel/issues/20272
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock
7 changes: 5 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ bazel_dep(name = "aspect_bazel_lib", version = "1.38.1")
bazel_dep(name = "aspect_rules_js", version = "1.34.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")

bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)
####### Dev dependencies ########

bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2.1", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_go", version = "0.46.0", dev_dependency = True)
6 changes: 6 additions & 0 deletions e2e/worker/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
12 changes: 6 additions & 6 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ def rules_webpack_internal_deps():

http_archive(
name = "io_bazel_rules_go",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip"],
sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip"],
)

http_archive(
name = "bazel_gazelle",
sha256 = "448e37e0dbf61d6fa8f00aaa12d191745e14f07c31cabfa731f0c8e8a4f41b97",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.28.0/bazel-gazelle-v0.28.0.tar.gz"],
integrity = "sha256-dd8ojEsxyB61D1Hi4U9HY8t1SNquEmgXJHBkY3/Z6mI=",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz"],
)

http_archive(
name = "bazel_skylib_gazelle_plugin",
sha256 = "0a466b61f331585f06ecdbbf2480b9edf70e067a53f261e0596acd573a7d2dc3",
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-gazelle-plugin-1.4.1.tar.gz"],
sha256 = "747addf3f508186234f6232674dd7786743efb8c68619aece5fb0cac97b8f415",
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-gazelle-plugin-1.5.0.tar.gz"],
)

http_archive(
Expand Down
5 changes: 3 additions & 2 deletions webpack/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//webpack/private:is_bazel_7_or_greater.bzl", "is_bazel_7_or_greater")

exports_files(["defs.bzl"])

Expand All @@ -9,7 +10,7 @@ bzl_library(
deps = [
"//webpack/private:webpack_bundle",
"//webpack/private:webpack_devserver",
],
] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if is_bazel_7_or_greater() else []),
)

bzl_library(
Expand All @@ -19,5 +20,5 @@ bzl_library(
deps = [
"@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
] + (["@bazel_tools//tools/build_defs/repo:cache.bzl"] if is_bazel_7_or_greater() else []),
)
7 changes: 7 additions & 0 deletions webpack/private/is_bazel_7_or_greater.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"is_bazel_7_or_greater"

def is_bazel_7_or_greater():
# Vendored in from https://github.com/aspect-build/bazel-lib/blob/adad7889c925c4f22a2f84568268f0a62e7c2fb0/lib/private/utils.bzl#L208
# so that rules_js remains compatible with aspect_bazel_lib >= 2.0.0 and < 2.2.0.
# TODO(2.0): remove this and switch to the upstream function and bump minimum aspect_bazel_lib version to 2.2.0
return "apple_binary" not in dir(native) and "cc_host_toolchain_alias" not in dir(native)

0 comments on commit 918e4eb

Please sign in to comment.