forked from envoyproxy/envoy-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bazelw
executable file
·64 lines (53 loc) · 1.72 KB
/
bazelw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -euo pipefail
readonly bazelisk_version="1.10.1"
if [[ $OSTYPE == darwin* ]]; then
readonly bazel_os="darwin"
else
readonly bazel_os="linux"
fi
raw_arch="$(uname -m)"
readonly raw_arch
if [[ "$raw_arch" == "aarch64" || "$raw_arch" == "arm64" ]]; then
readonly bazel_arch="arm64"
else
readonly bazel_arch="amd64"
fi
bazel_platform="$bazel_os-$bazel_arch"
case "$bazel_platform" in
darwin-arm64)
readonly bazel_version_sha="c22d48601466d9d3b043ccd74051f2f4230f9b9f4509f097017c97303aa88d13"
;;
darwin-amd64)
readonly bazel_version_sha="e485bbf84532d02a60b0eb23c702610b5408df3a199087a4f2b5e0995bbf2d5a"
;;
linux-arm64)
readonly bazel_version_sha="c1de6860dd4f8d5e2ec270097bd46d6a211b971a0b8b38559784bd051ea950a1"
;;
linux-amd64)
readonly bazel_version_sha="4cb534c52cdd47a6223d4596d530e7c9c785438ab3b0a49ff347e991c210b2cd"
;;
*)
echo "Unsupported platform $OSTYPE $raw_arch" >&2
exit 1
esac
readonly bazel_version_url="https://github.com/bazelbuild/bazelisk/releases/download/v$bazelisk_version/bazelisk-$bazel_platform"
script_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly bazelisk="$script_root/tmp/bazel/versions/bazelisk-$bazelisk_version-$bazel_platform"
if [[ ! -x "$bazelisk" ]]; then
echo "Installing bazelisk..." >&2
mkdir -p "$(dirname "$bazelisk")"
download_bazelisk() {
curl --fail -L --retry 5 --retry-connrefused --silent --progress-bar \
--output "$bazelisk" "$bazel_version_url"
}
download_bazelisk || download_bazelisk
if echo "$bazel_version_sha $bazelisk" | shasum --check --status; then
chmod +x "$bazelisk"
else
echo "Bazelisk sha mismatch" >&2
rm -f "$bazelisk"
exit 1
fi
fi
exec "$bazelisk" "$@"