Skip to content

Commit

Permalink
build: upgrade to latest bazel 7.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Oct 18, 2024
1 parent a6a7588 commit afb18ef
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
7.3.2
10 changes: 7 additions & 3 deletions .github/workflows/bazel7.bazelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Speed up all builds by not checking if external repository files have been modified.
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244
build --noexperimental_check_external_repository_files
fetch --noexperimental_check_external_repository_files
query --noexperimental_check_external_repository_files
common --noexperimental_check_external_repository_files

# Don't report when the root module's lower bound for a dependency happens to be less than the resolved version.
# This is expected and should NOT prompt an engineer to update our lower bound to match.
# WARNING: For repository 'aspect_bazel_lib', the root module requires module version [email protected],
# but got [email protected] in the resolved dependency graph.
common --check_direct_dependencies=off

# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs.
# Save time on Sandbox creation and deletion when many of the same kind of action run during the
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ jobs:
- name: Mount bazel caches
uses: actions/cache@v4
with:
# Cache the --dist_cache and --repository_cache directories (see ci.bazelrc)
# and the default bazel output (https://bazel.build/remote/output-directories#layout)
# and bazelisk cache.
path: |
~/.cache/bazel-disk-cache
~/.cache/bazel-repository-cache
~/.cache/xdg-cache
~/.cache/bazel
~/.cache/bazelisk
key: >-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', '**/*.js', '!e2e') }}-
Expand Down Expand Up @@ -152,8 +156,6 @@ jobs:
--build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
--enable_bzlmod=${{ matrix.bzlmod }} \
//...
env:
XDG_CACHE_HOME: ~/.cache/xdg-cache # bazelisk will download bazel to here
test-worker:
runs-on: ubuntu-latest
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ jobs:
- name: Mount bazel caches
uses: actions/cache@v4
with:
# Cache the --dist_cache and --repository_cache directories (see ci.bazelrc)
# and the default bazel output (https://bazel.build/remote/output-directories#layout)
# and bazelisk cache.
path: |
"~/.cache/bazel"
"~/.cache/bazel-repo"
~/.cache/bazel-disk-cache
~/.cache/bazel-repository-cache
~/.cache/bazel
~/.cache/bazelisk
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: bazel-cache-
- name: bazel test //...
env:
# Bazelisk will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //...
- name: Prepare release
run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ module(
)

# Lower-bounds (minimum) versions for direct runtime dependencies
bazel_dep(name = "aspect_bazel_lib", version = "2.7.7")
bazel_dep(name = "aspect_bazel_lib", version = "2.8.1")
bazel_dep(name = "aspect_rules_js", version = "2.0.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "platforms", version = "0.0.10")

# TODO(4.x): remove support for non-toolchainized protoc
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
Expand Down
14 changes: 12 additions & 2 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This load statement must be in the docs/ package rather than anything users depend on
# so that the dependency on stardoc doesn't leak to them.
load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs")
load(":docs.bzl", "stardoc_with_diff_test", "update_docs")

stardoc_with_diff_test(
name = "rules",
Expand Down Expand Up @@ -48,7 +48,12 @@ sh_binary(
name = "docs_delivery_only_on_change",
srcs = ["delivery.sh"],
data = glob(["*.md"]),
tags = ["deliverable"],
tags = [
"deliverable",
"skip-on-bazel6",
"skip-on-bzlmod-0",
"skip-on-rbe",
],
)

# Demonstration delivery target for Aspect Workflows.
Expand All @@ -57,4 +62,9 @@ sh_binary(
name = "docs_delivery",
srcs = ["delivery.sh"],
data = glob(["*.md"]),
tags = [
"skip-on-bazel6",
"skip-on-bzlmod-0",
"skip-on-rbe",
],
)
18 changes: 18 additions & 0 deletions docs/docs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used.
"""

load("@aspect_bazel_lib//lib:docs.bzl", _stardoc_with_diff_test = "stardoc_with_diff_test", _update_docs = "update_docs")
load("@aspect_bazel_lib//lib:utils.bzl", "is_bazel_7_or_greater")

def stardoc_with_diff_test(name, **kwargs):
"""
Wrapper around stardoc_with_diff_test that only runs the test if Bazel 7 or greater is being used.
"""
if is_bazel_7_or_greater():
_stardoc_with_diff_test(name, **kwargs)
else:
# buildifier: disable=print
print("WARNING: Skipping stardoc_with_diff_test for %s because it requires Bazel 7 or greater" % name)

update_docs = _update_docs
6 changes: 3 additions & 3 deletions ts/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def rules_ts_bazel_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "6d758a8f646ecee7a3e294fbe4386daafbe0e5966723009c290d493f227c390b",
strip_prefix = "bazel-lib-2.7.7",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.7/bazel-lib-v2.7.7.tar.gz",
sha256 = "688354ee6beeba7194243d73eb0992b9a12e8edeeeec5b6544f4b531a3112237",
strip_prefix = "bazel-lib-2.8.1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.8.1/bazel-lib-v2.8.1.tar.gz",
)

http_archive(
Expand Down

0 comments on commit afb18ef

Please sign in to comment.