55 lines
1.7 KiB
Ruby
55 lines
1.7 KiB
Ruby
class Bazel < Formula
|
|
desc "Google's own build tool"
|
|
homepage "https://bazel.build/"
|
|
url "https://github.com/bazelbuild/bazel/releases/download/0.4.2/bazel-0.4.2-dist.zip"
|
|
sha256 "8e6f41252abadcdb2cc7a07f910ec4b45fb12c46f0a578672c6a186c7efcdb36"
|
|
head "https://github.com/bazelbuild/bazel.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "3787bc81081acf05c6267d8af42c2810ed6d4eae7b173006e7225b4e48d6f452" => :sierra
|
|
sha256 "0e76a2a36d71c8ab1d002b5ac027f1d484d04d8ca27d409bde9391114d8b35a4" => :el_capitan
|
|
sha256 "a0b4d071f7117174b54b3230937579762a189c6d70a868cdbd233c99e6e3be12" => :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
|