-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade to Bazel 8.0.0 (#423)
- Upgrade to Bazel 8.0.0. - Use `rules_shell`. - Refactor `bazel_binary` template to check for Bazelisk binary and export the value. prevents issues with the runfiles for the `bazel_binary` not being present if used with the `updatesrc` rules from `cgrindel/bazel-starlib`. - Enhanced the error message when runfiles cannot be found. - Update integration test to use `last_green` for some integration tests. Closes #414. Closes #410.
- Loading branch information
Showing
36 changed files
with
175 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7.4.1 | ||
8.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 30 additions & 17 deletions
47
bazel_integration_test/private/bazel_binaries_script.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# --- begin runfiles.bash initialization v2 --- | ||
# Copy-pasted from the Bazel Bash runfiles library v2. | ||
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash | ||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$0.runfiles/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e | ||
# --- end runfiles.bash initialization v2 --- | ||
# vi: ft=sh | ||
|
||
export USE_BAZEL_VERSION="{version}" | ||
|
||
# Need to write data here, the default is read-obly inside tests. | ||
export BAZELISK_HOME="${PWD}" | ||
# Need to write data here, the default is read-only inside tests. | ||
if [[ -z "${BAZELISK_HOME:-}" ]]; then | ||
export BAZELISK_HOME="${PWD}" | ||
fi | ||
|
||
# Find the bazelisk binary, if it has not already been found. | ||
# | ||
# Code that uses cgrindel/bazel-starlib's updatesrc utilities can execute Bazel | ||
# invocations from directories that cannot find the runfiles. The first | ||
# invocation will find the BIT_BAZELISK_BINARY. So, we export the value so that | ||
# subsequent invocations can find it. This allows us to forgo the runfiles | ||
# evaluation for this script in those cases. | ||
if [[ -z "${BIT_BAZELISK_BINARY:-}" ]]; then | ||
# --- begin runfiles.bash initialization v2 --- | ||
# Copy-pasted from the Bazel Bash runfiles library v2. | ||
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash | ||
# shellcheck disable=SC1090 | ||
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$0.runfiles/$f" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ | ||
{ echo>&2 "ERROR: ${BASH_SOURCE[0]} cannot find $f"; exit 1; }; f=; set -e | ||
# --- end runfiles.bash initialization v2 --- | ||
|
||
# Find the bazelisk binary. | ||
BINARY="$(rlocation {bazelisk})" || \ | ||
(echo >&2 "Failed to locate bazelisk at {bazelisk}" && exit 1) | ||
BIT_BAZELISK_BINARY="$(rlocation {bazelisk})" || \ | ||
(echo >&2 "Failed to locate bazelisk at {bazelisk}" && exit 1) | ||
export BIT_BAZELISK_BINARY | ||
fi | ||
|
||
exec "${BINARY}" ${BIT_STARTUP_OPTIONS:-} "$@" | ||
exec "${BIT_BAZELISK_BINARY}" ${BIT_STARTUP_OPTIONS:-} "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.