-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: Add bazel wrapper This wrapper is a simple shell script that handles downloading bazel. This ensures that all developers are using the same supported version of bazel, as well as keeping it in lockstep with CI. This also means developers who aren't already using bazel don't have to figure out how to install it on their system globally. Signed-off-by: Keith Smiley <keithbsmiley@gmail.com> Signed-off-by: JP Simard <jp@jpsim.com>
- Loading branch information
Showing
5 changed files
with
59 additions
and
24 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 |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
*.pyc | ||
tags | ||
.vscode | ||
/tmp/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
readonly bazel_version="0.26.1" | ||
if [[ $OSTYPE == darwin* ]]; then | ||
readonly bazel_platform="darwin" | ||
readonly bazel_version_sha="9b416e0c9bde5fd59264eacc35d518d2465b5591fbaf3656e386970c045d4747" | ||
else | ||
readonly bazel_platform="linux" | ||
readonly bazel_version_sha="6c50e142a0a405d3d8598050d6c1b3920c8cdb82a7ffca6fc067cb474275148f" | ||
fi | ||
|
||
readonly bazel_version_url="https://github.com/bazelbuild/bazel/releases/download/$bazel_version/bazel-$bazel_version-$bazel_platform-x86_64" | ||
readonly script_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
readonly bazel_root="$script_root/tmp/bazel/versions/$bazel_version-$bazel_platform" | ||
readonly bazel_executable="$bazel_root/bin/bazel" | ||
|
||
if [[ ! -x "$bazel_executable" ]]; then | ||
echo "Installing bazel..." >&2 | ||
mkdir -p "$(dirname "$bazel_executable")" | ||
extra_curl_args="" | ||
if [[ -n "${BUILD_BUILDID:-}" ]]; then | ||
extra_curl_args="--silent" | ||
fi | ||
|
||
curl \ | ||
--show-error \ | ||
$extra_curl_args \ | ||
--progress-bar \ | ||
--retry 3 \ | ||
--fail \ | ||
--location \ | ||
--output "$bazel_executable" \ | ||
"$bazel_version_url" | ||
|
||
if echo "$bazel_version_sha $bazel_executable" | shasum --check --status; then | ||
chmod +x "$bazel_executable" | ||
else | ||
echo "Bazel installer sha mismatch" >&2 | ||
rm -f "$bazel_executable" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exec "$bazel_executable" "$@" |
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