homebrew-core/Formula/bazel.rb
2018-02-01 02:34:28 -08:00

56 lines
1.8 KiB
Ruby

class Bazel < Formula
desc "Google's own build tool"
homepage "https://bazel.build/"
url "https://github.com/bazelbuild/bazel/releases/download/0.10.0/bazel-0.10.0-dist.zip"
sha256 "47e0798caaac4df499bce5fe554a914abd884a855a27085a4473de1d737d9548"
bottle do
cellar :any_skip_relocation
sha256 "4012482a30d3e35b41b65260919e15ff8c2306eecf9218107c5cbf3af1fa3c3e" => :high_sierra
sha256 "a79b74382cb314115847214ebd37e9fab6d2eda4a1c61548222cdbe18f1ac75e" => :sierra
sha256 "2f67fa0c82c6f58e432f5aff6f2b71540536a0bd88d1116f5b7573f9fe2d86be" => :el_capitan
end
depends_on :java => "1.8"
depends_on :macos => :yosemite
def install
ENV["EMBED_LABEL"] = "#{version}-homebrew"
# Force Bazel ./compile.sh to put its temporary files in the buildpath
ENV["BAZEL_WRKDIR"] = buildpath/"work"
system "./compile.sh"
system "./output/bazel", "--output_user_root", buildpath/"output_user_root",
"build", "scripts:bash_completion"
bin.install "scripts/packages/bazel.sh" => "bazel"
bin.install "output/bazel" => "bazel-real"
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("1.8"))
bash_completion.install "bazel-bin/scripts/bazel-complete.bash"
zsh_completion.install "scripts/zsh_completion/_bazel"
end
test do
touch testpath/"WORKSPACE"
(testpath/"ProjectRunner.java").write <<~EOS
public class ProjectRunner {
public static void main(String args[]) {
System.out.println("Hi!");
}
}
EOS
(testpath/"BUILD").write <<~EOS
java_binary(
name = "bazel-test",
srcs = glob(["*.java"]),
main_class = "ProjectRunner",
)
EOS
system bin/"bazel", "build", "//:bazel-test"
system "bazel-bin/bazel-test"
end
end