forked from bazeltools/bazel-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bazel
executable file
·35 lines (28 loc) · 898 Bytes
/
bazel
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
#!/bin/bash
set -e
TMPDIR="${TMPDIR:-/tmp}"
if [ -z "$BAZEL_BIN_LOC" ]; then
BAZEL_BIN_LOC=~/.bazel_binaries
fi
mkdir -p "$BAZEL_BIN_LOC"
if [ "$(uname -s)" == "Linux" ]; then
export BAZEL_LAUNCHER_PLATFORM_NAME='linux'
elif [ "$(uname -s)" == "Darwin" ]; then
export BAZEL_LAUNCHER_PLATFORM_NAME='darwin'
else
"Your platform $(uname -s) is unsupported, sorry"
exit 1
fi
BAZELISK_VERSION=v1.11.0
EXPECTED_BINARY_LOCATION="$BAZEL_BIN_LOC/$BAZELISK_VERSION"
if [ ! -f "$EXPECTED_BINARY_LOCATION" ]; then
ARCH="$(uname -m)"
suffix="amd64"
if [ "$ARCH" == "arm64" ]; then
suffix="arm64"
fi
DOWNLOAD_URL="https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-${BAZEL_LAUNCHER_PLATFORM_NAME}-${suffix}"
curl -f -L -o "$EXPECTED_BINARY_LOCATION" "$DOWNLOAD_URL"
chmod +x $EXPECTED_BINARY_LOCATION
fi
exec "$EXPECTED_BINARY_LOCATION" "$@"