Last active
January 15, 2023 23:58
-
-
Save thundergolfer/c4cb1b830078d19ce9758efed06746a0 to your computer and use it in GitHub Desktop.
Install Bazel (with Bazelisk) on Codespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
main() { | |
local version | |
local dest | |
local op_sys | |
local architecture | |
version="v1.7.4" | |
dest="/usr/local/bin/bazel" | |
op_sys="$(uname)" | |
architecture="" | |
case $(uname -m) in | |
i386) architecture="386" ;; | |
i686) architecture="386" ;; | |
x86_64) architecture="amd64" ;; | |
arm) dpkg --print-architecture | grep -q "arm64" && architecture="arm64" || architecture="arm" ;; | |
esac | |
# NOTE: 'sudo' is required in Github Codespaces | |
if [[ "${op_sys}" == "Darwin" && "${architecture}" == "amd64" ]]; then | |
sudo wget "https://github.com/bazelbuild/bazelisk/releases/download/${version}/bazelisk-darwin-amd64" -O "${dest}" | |
elif [[ "${op_sys}" == "Linux" && "${architecture}" == "amd64" ]]; then | |
sudo wget "https://github.com/bazelbuild/bazelisk/releases/download/${version}/bazelisk-linux-amd64" -O "${dest}" | |
else | |
echo "Install script does not support OS '${op_sys}' and Architecture '${architecture}'." | |
exit 1 | |
fi | |
sudo chmod +x /usr/local/bin/bazel | |
echo "Bazelisk installed as the 'bazel' binary to '${dest}'" | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment