forked from zml/zml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbazel.sh
More file actions
executable file
·36 lines (31 loc) · 820 Bytes
/
bazel.sh
File metadata and controls
executable file
·36 lines (31 loc) · 820 Bytes
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
#!/bin/bash
BAZELISK_VERSION=v1.25.0
case $OSTYPE in
"darwin"*)
OS="darwin"
CACHE_DIR="${HOME}/Library/Caches/bazelisk"
;;
"linux"*)
OS="linux"
if [[ -n "${XDG_CACHE_HOME}" ]]; then
CACHE_DIR="${XDG_CACHE_HOME}/bazelisk"
else
CACHE_DIR="${HOME}/.cache/bazelisk"
fi
;;
esac
case $(uname -m) in
"arm64")
ARCH="arm64"
;;
"x86_64")
ARCH="amd64"
;;
esac
BAZELISK="${CACHE_DIR}/bazelisk-${BAZELISK_VERSION}"
if [[ ! -f "${BAZELISK}" ]]; then
mkdir -p "${CACHE_DIR}"
curl -L -o "${CACHE_DIR}/bazelisk-${BAZELISK_VERSION}" "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-${OS}-${ARCH}"
chmod +x "${BAZELISK}"
fi
exec "${BAZELISK}" "$@"