1

.envrc style

This commit is contained in:
Motiejus Jakštys 2021-09-06 17:11:11 +03:00
parent 11e8022814
commit bf183e1e04

31
.envrc
View File

@ -1,25 +1,22 @@
export PATH="$(git rev-parse --show-toplevel)/bin:$PATH" export PATH="$(git rev-parse --show-toplevel)/bin:$PATH"
err() { [[ -x bin/bazel ]] && exit
>&2 echo "$*"
exit 1
}
goos=$(uname | tr A-Z a-z)
case $(uname -m) in case $(uname -m) in
x86_64) goarch=amd64;; x86_64)
aarch64) goarch=arm64;; goarch=amd64;;
*) err "unsupported architecture $(uname -m)" aarch64)
goarch=arm64;;
*)
>&2 echo "unsupported architecture $(uname -m)"
exit 1;;
esac esac
if [[ -x bin/bazel ]]; then bzl="bazelisk-$(uname | tr A-Z a-z)-${goarch}"
exit
fi
rm -f "bin/bazelisk-${goos}-${goarch}" rm -f "bin/$bzl"
wget --no-verbose "https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-${goos}-${goarch}" \ wget --no-verbose "https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/$bzl" \
-O "bin/bazelisk-${goos}-${goarch}" -O "bin/$bzl"
sha256sum -c --ignore-missing <<-EOF sha256sum -c --ignore-missing <<-EOF
e485bbf84532d02a60b0eb23c702610b5408df3a199087a4f2b5e0995bbf2d5a bin/bazelisk-darwin-amd64 e485bbf84532d02a60b0eb23c702610b5408df3a199087a4f2b5e0995bbf2d5a bin/bazelisk-darwin-amd64
@ -28,5 +25,5 @@ c22d48601466d9d3b043ccd74051f2f4230f9b9f4509f097017c97303aa88d13 bin/bazelisk-d
c1de6860dd4f8d5e2ec270097bd46d6a211b971a0b8b38559784bd051ea950a1 bin/bazelisk-linux-arm64 c1de6860dd4f8d5e2ec270097bd46d6a211b971a0b8b38559784bd051ea950a1 bin/bazelisk-linux-arm64
EOF EOF
chmod a+x "bin/bazelisk-${goos}-${goarch}" chmod a+x "bin/$bzl"
mv "bin/bazelisk-${goos}-${goarch}" bin/bazel mv "bin/$bzl" bin/bazel