homebrew-core/Formula/bazelisk.rb

48 lines
1.7 KiB
Ruby

class Bazelisk < Formula
desc "User-friendly launcher for Bazel"
homepage "https://github.com/bazelbuild/bazelisk/"
url "https://github.com/bazelbuild/bazelisk.git",
tag: "v1.7.4",
revision: "3b5aa4468260727974ea62d4e9e810a17649f5b7"
license "Apache-2.0"
head "https://github.com/bazelbuild/bazelisk.git"
bottle do
cellar :any_skip_relocation
rebuild 1
sha256 "354107c197c4d92a1d45d2bfe99f9b3c8b4f3aae98c4a4f72139ebffd35fd77e" => :big_sur
sha256 "3ec79ba1054922b260d6a1442534b192d190c009d821e70c8b761508c859a908" => :catalina
sha256 "adc2762a3a35e6bf944fdb82b9fc86bacac7362496e41d98b16aa487f66f152f" => :mojave
end
depends_on "go" => :build
conflicts_with "bazel", because: "Bazelisk replaces the bazel binary"
resource "bazel_zsh_completion" do
url "https://raw.githubusercontent.com/bazelbuild/bazel/036e533/scripts/zsh_completion/_bazel"
sha256 "4094dc84add2f23823bc341186adf6b8487fbd5d4164bd52d98891c41511eba4"
end
def install
system "go", "build", *std_go_args, "-ldflags", "-X main.BazeliskVersion=#{version}"
bin.install_symlink "bazelisk" => "bazel"
resource("bazel_zsh_completion").stage do
zsh_completion.install "_bazel"
end
end
test do
ENV["USE_BAZEL_VERSION"] = Formula["bazel"].version
assert_match "Build label: #{Formula["bazel"].version}", shell_output("#{bin}/bazelisk version")
# This is an older than current version, so that we can test that bazelisk
# will target an explicit version we specify. This version shouldn't need to
# be bumped.
ENV["USE_BAZEL_VERSION"] = "0.28.0"
assert_match "Build label: 0.28.0", shell_output("#{bin}/bazelisk version")
end
end