class Bazel < Formula desc "Google's own build tool" homepage "https://bazel.build/" url "https://github.com/bazelbuild/bazel/releases/download/0.14.1/bazel-0.14.1-dist.zip" sha256 "d49cdcd82618ae7a7a190e6f0a80d9bf85c1a66b732f994f37732dc14ffb0025" bottle do cellar :any_skip_relocation sha256 "96a434cc3a705618751bf738fa1d5644127ccfa0b8f94bef2a25ba60baa28996" => :high_sierra sha256 "9bddb475141e5a61669a1e0c6328c198dfa641b24a24bcc705b811e19bb10408" => :sierra sha256 "09aa108d3e7cf22d5414a3135425f85353ce77c5673359460a0be228b307988c" => :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" (buildpath/"sources").install buildpath.children cd "sources" do 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" prefix.install_metafiles end 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