bin_dir := "$HOME/bin" build := "bazel build --config=quiet" # they say you can do else ifs but i could never get it working # https://github.com/casey/just#conditional-expressions bazeliskOS := if os_family() == "windows" { "bazelisk-windows-amd64.exe" } else { if os() == "macos" { if arch() == "aarch64" { "darwin-arm64" } else { "darwin-amd64" } } else { if arch() == "arm" { "linux-arm64" } else { "linux-amd64" } } } ibazelOS := if os_family() == "windows" { "windows_amd64.exe" } else { if os() == "macos" { if arch() == "aarch64" { "darwin_arm64" } else { "darwin_amd64" } } else { "linux_amd64" } } # creates {{bin_dir}} if it doesnt exist, so we can install tools to directories # owned by the user _mkdir: @mkdir -p {{bin_dir}} # message reminding people to update their $PATH so that ~/bin is on it _setup-path-msg: @echo "\n\nTOOL INSTALLATION COMPLETE.\n\n" @echo "NEXT STEPS:" @echo "- Add {{bin_dir}} to your \$PATH variable in your ~/.bashrc or ~/.zshrc to add the installed tools to your path." @echo "- Don't forget to run 'source ~/{.bashrc or .zshrc}' for the changes to take effect" # sets up symlinks for tooling binaries managed by this repository to {{bin_dir}}. should only be ran once link-tools target: _mkdir # run linking script from root of repository @cd .. && hack/link-tools.sh {{bin_dir}} {{target}} @just _setup-path-msg clean-links: # deleting all linked tools: find {{bin_dir}} -maxdepth 1 -type l find {{bin_dir}} -maxdepth 1 -type l | xargs rm # run `just link` to relink default development tools # # REPOSITORY BOOTSTRAP RECIPES # # installs bazel tooling to {{bin_dir}}, should be ran one time per dev machine bazel: _mkdir bazelisk bazel-watcher _setup-path-msg # Installs Bazelisk as Bazel, one-time per machine bazelisk version="1.17.0": #!/usr/bin/env bash set -ex if command -v bazel &> /dev/null then echo "Bazel already installed, uninstall if you want to reinstall" echo "then re-run this recipe: just hack/bazelisk" exit fi echo "I am going to install bazelisk as bazel. You can treat it as bazel." curl -Lo {{bin_dir}}/bazel https://github.com/bazelbuild/bazelisk/releases/download/v{{version}}/bazelisk-{{bazeliskOS}} chmod +x {{bin_dir}}/bazel echo "You can now use bazel directly from the command line" # Installs iBazel, the Bazel + file watcher utility bazel-watcher version="0.22.0": #!/usr/bin/env bash set -ex if command -v ibazel &> /dev/null then echo "bazel-watcher already installed, uninstall if you want to reinstall" echo "then re-run this recipe: just hack/bazel-watcher" exit fi echo "Installing ibazel..." curl -Lo {{bin_dir}}/ibazel https://github.com/bazelbuild/bazel-watcher/releases/download/v{{version}}/ibazel_{{ibazelOS}} chmod +x {{bin_dir}}/ibazel echo "Successfully installed, replace bazel calls with ibazel to automatically rerun on file change."