56 lines
1.8 KiB
Ruby
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.8.0/bazel-0.8.0-dist.zip"
|
|
sha256 "aa840321d056abd3c6be10c4a1e98a64f9f73fff9aa89c468dae8c003974a078"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "d520b2179836981c0caa8bf6f30c0af358a04ed25531f07a723091a323512850" => :high_sierra
|
|
sha256 "23f5efc1f93950b8a66fed135e6e4ffd492df6664455c2ee35ff92fb927499d3" => :sierra
|
|
sha256 "348245044d0eae3182d0521b28469cedf0a9de40286a1efbe728ede0c85b1f3c" => :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
|