2022-02-04 11:16:52 +02:00
|
|
|
set -eu
|
2021-09-07 10:54:33 +03:00
|
|
|
|
2022-04-13 15:58:11 +03:00
|
|
|
BIN_DIR="$(git rev-parse --show-toplevel)/bin"
|
|
|
|
export PATH="$BIN_DIR:$PATH"
|
2021-06-28 12:52:20 +03:00
|
|
|
|
2022-07-12 14:29:54 +03:00
|
|
|
_u_bzl=https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-
|
|
|
|
_u_bldf=https://github.com/bazelbuild/buildtools/releases/download/5.1.0/buildifier-
|
2021-09-06 17:02:17 +03:00
|
|
|
|
2022-04-13 15:58:11 +03:00
|
|
|
if [[ "${PRINT_TOOL_HASHES:-no}" = "yes" ]]; then
|
|
|
|
for os in linux darwin; do
|
|
|
|
for arch in amd64 arm64; do
|
|
|
|
hash_bzl=$(direnv fetchurl "${_u_bzl}$os-$arch")
|
|
|
|
hash_bldf=$(direnv fetchurl "${_u_bldf}$os-$arch")
|
|
|
|
echo -e "bzl: $os-$arch\t$hash_bzl"
|
|
|
|
echo -e "bldf: $os-$arch\t$hash_bldf"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# to fetch the hashes, run:
|
|
|
|
# $ PRINT_TOOL_HASHES=yes bash .envrc
|
2021-09-07 10:49:39 +03:00
|
|
|
case "$(uname | tr A-Z a-z)-$(uname -m)" in
|
|
|
|
linux-x86_64)
|
2022-07-12 14:29:54 +03:00
|
|
|
bzl=$(direnv fetchurl "${_u_bzl}linux-amd64" sha256-awvLLqFbyhb/+r5v2nWANEA3U1TAhUgP42HSy/MlAds=)
|
|
|
|
bldf=$(direnv fetchurl "${_u_bldf}linux-amd64" sha256-Ur9rECy0+IRk4ZfKrAbWl5P6KwX1rVCn579vvWVmSKM=)
|
2022-04-13 15:58:11 +03:00
|
|
|
;;
|
2021-09-07 10:49:39 +03:00
|
|
|
linux-aarch64)
|
2022-07-12 14:29:54 +03:00
|
|
|
bzl=$(direnv fetchurl "${_u_bzl}linux-arm64" sha256-KdhhykjfJKPo3sV/sAUIumZKMZIQR7JobDjPmiDUY58=)
|
|
|
|
bldf=$(direnv fetchurl "${_u_bldf}linux-arm64" sha256-kX1ZnbsEDmOuen4a23ENIFeBGQL9yeNczpJev9lm7rg=)
|
2022-04-13 15:58:11 +03:00
|
|
|
;;
|
2021-09-07 10:49:39 +03:00
|
|
|
darwin-x86_64)
|
2022-07-12 14:29:54 +03:00
|
|
|
bzl=$(direnv fetchurl "${_u_bzl}darwin-amd64" sha256-cM9/50gI0WQY03H+uMzU58RCFdsD0sT/x1t2e3ZUCfs=)
|
|
|
|
bldf=$(direnv fetchurl "${_u_bldf}darwin-amd64" sha256-yTeNn0KT/DjsVKCPvHTnqdKJFNrmiRM0QB5Z849uZdw=)
|
2022-04-13 15:58:11 +03:00
|
|
|
;;
|
2022-02-11 01:20:56 +02:00
|
|
|
darwin-arm64)
|
2022-07-12 14:29:54 +03:00
|
|
|
bzl=$(direnv fetchurl "${_u_bzl}darwin-arm64" sha256-NFu4uQDWue90I06enkE67Tj7Ke8lXkrhisYb9KYQLYQ=)
|
|
|
|
bldf=$(direnv fetchurl "${_u_bldf}darwin-arm64" sha256-dF/rXqlstv85p2soIcV1kf1wtSgyVWJIbUe10IkA4uQ=)
|
2022-04-13 15:58:11 +03:00
|
|
|
;;
|
2021-09-06 17:11:11 +03:00
|
|
|
*)
|
2021-09-07 10:49:39 +03:00
|
|
|
>&2 echo "unsupported architecture tuple $(uname | tr A-Z a-z)-$(uname -m)"
|
2021-09-06 17:11:11 +03:00
|
|
|
exit 1;;
|
2021-09-06 17:02:17 +03:00
|
|
|
esac
|
|
|
|
|
2022-04-13 15:58:11 +03:00
|
|
|
ln -sf "${bzl}" "$BIN_DIR/bazel"
|
|
|
|
ln -sf "${bldf}" "$BIN_DIR/buildifier"
|