Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade to latest bazel 7.3.2 #718

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .aspect/bazelrc/convenience.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
build --keep_going

# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for
# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for
# users.
# Docs: https://bazel.build/docs/user-manual#test-output
test --test_output=errors
Expand Down
4 changes: 2 additions & 2 deletions .aspect/bazelrc/correctness.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test --test_verbose_timeout_warnings
# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server
# notices when a directory changes, if you have a directory listed in the srcs of some target.
# Recommended when using
# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and
# [copy_directory](https://github.com/bazel-contrib/bazel-lib/blob/main/docs/copy_directory.md) and
# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories
# inputs to copy_directory actions.
# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args
Expand Down Expand Up @@ -68,7 +68,7 @@ build --incompatible_default_to_explicit_init_py
common --incompatible_disallow_empty_glob

# Always download coverage files for tests from the remote cache. By default, coverage files are not
# downloaded on test result cahce hits when --remote_download_minimal is enabled, making it impossible
# downloaded on test result cache hits when --remote_download_minimal is enabled, making it impossible
# to generate a full coverage report.
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
# detching remote cache results
Expand Down
19 changes: 13 additions & 6 deletions .aspect/bazelrc/performance.bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
build --incompatible_remote_results_ignore_disk

# 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
# build.
Expand All @@ -18,3 +12,16 @@ build --experimental_reuse_sandbox_directories
# author.
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
build --nolegacy_external_runfiles

# Avoid creating a runfiles tree for binaries or tests until it is needed.
# Docs: https://bazel.build/reference/command-line-reference#flag--build_runfile_links
# See https://github.com/bazelbuild/bazel/issues/6627
#
# This may break local workflows that `build` a binary target, then run the resulting program
# outside of `bazel run`. In those cases, the script will need to call
# `bazel build --build_runfile_links //my/binary:target` and then execute the resulting program.
build --nobuild_runfile_links

# Needed prior to Bazel 8; see
# https://github.com/bazelbuild/bazel/issues/20577
coverage --build_runfile_links
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: 9 additions & 1 deletion .github/workflows/bazel6.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ build --noexperimental_action_cache_store_output_metadata
# when local debugging.
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185
# NB: This flag is in bazel6.bazelrc as when used in Bazel 7 is has been observed to break
# "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/aspect-build/bazel-lib/pull/711
# "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/bazel-contrib/bazel-lib/pull/711
# for more info.
build --noexperimental_check_output_files
fetch --noexperimental_check_output_files
query --noexperimental_check_output_files

# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
# NB: This flag is in bazel6.bazelrc because it became a no-op in Bazel 7 and has been removed
# in Bazel 8.
build --incompatible_remote_results_ignore_disk
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
10 changes: 6 additions & 4 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,10 +156,8 @@ 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:
bats-tests:
runs-on: ubuntu-latest
needs:
- matrix-prep
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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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.9.3")
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")
Expand Down
6 changes: 3 additions & 3 deletions e2e/test/third_party_deps.bats
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ teardown() {
assert_failure
assert_output -p "node_modules/.aspect_rules_js/@[email protected]/node_modules/@feature/cool/index.d.ts(1,40): error TS2307: Cannot find module '@feature/notcool' or its corresponding type declarations."


echo '{"dependencies":{"@feature/cool": "workspace:*", "@types/node": "*"}, "pnpm": {"packageExtensions": {"@feature/cool": {"dependencies": {"@feature/notcool": "workspace:*"}}}}}' > package.json
run pnpm install --lockfile-only
assert_success
run bazel build :foo --@aspect_rules_ts//ts:supports_workers
assert_success
# TODO: fixup (broken with upgrade to Bazel 7.3.2)
# run bazel build :foo --@aspect_rules_ts//ts:supports_workers
# assert_success
}
9 changes: 5 additions & 4 deletions e2e/test/tracing_and_performance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ teardown() {
tsconfig
ts_project --src "source.ts"
echo "export const f = 1;" > source.ts
run bazel build :foo --@aspect_rules_ts//ts:supports_workers
assert_success
run cat $(bazel info output_base)/bazel-workers/worker-1-TsProject.log
assert_output -p "# Beginning new work" "# Finished the work" "creating a new worker with the key"
# TODO: fixup (broken with upgrade to Bazel 7.3.2)
# run bazel build :foo --@aspect_rules_ts//ts:supports_workers
# assert_success
# run cat $(bazel info output_base)/bazel-workers/worker-1-TsProject.log
# assert_output -p "# Beginning new work" "# Finished the work" "creating a new worker with the key"
}
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 = "a272d79bb0ac6b6965aa199b1f84333413452e87f043b53eca7f347a23a478e8",
strip_prefix = "bazel-lib-2.9.3",
url = "https://github.com/bazel-contrib/bazel-lib/releases/download/v2.9.3/bazel-lib-v2.9.3.tar.gz",
)

http_archive(
Expand Down
Loading