class Bazel < Formula desc "Google's own build tool" homepage "https://bazel.build/" url "https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-dist.zip" sha256 "2b737be42678900470ae9e48c975ac5b2296d9ae23c007bf118350dbe7c0552b" bottle do cellar :any_skip_relocation sha256 "c9b4b1565b2a235c44003a1bb4e683a19d3b173ce77c03b50906eeda3f62daea" => :sierra sha256 "065d351e027c647de623fe8c88a90b36923474858f36b73cad787af452f46988" => :el_capitan sha256 "8a2a94f1bd43289a50c8855c530105af4e6ba2ea3d0e2955f1827c43f18e07d5" => :yosemite 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" 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.undent public class ProjectRunner { public static void main(String args[]) { System.out.println("Hi!"); } } EOS (testpath/"BUILD").write <<-EOS.undent 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