62 lines
1.9 KiB
Ruby
62 lines
1.9 KiB
Ruby
class Bazel < Formula
|
|
desc "Google's own build tool"
|
|
homepage "https://bazel.build/"
|
|
url "https://github.com/bazelbuild/bazel/releases/download/0.15.1/bazel-0.15.1-dist.zip"
|
|
sha256 "c62b351fa4c1ba5aeb34d0a137176f8e8f1d89a32f548a10e96c11df176ffc6c"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "395fb1fc6357e5dcba5049ce62eb50eab6e1a29f541671ae9f7fbdfb0002b40b" => :high_sierra
|
|
sha256 "e9eff8571e38690b9f19116923ba9f76d0c9fa62cf76c62aa5f1a80df4bab89e" => :sierra
|
|
sha256 "8c3483f28a6cd772a537b0cfd137cf01cec0981fa16c3f283349584fa2f67773" => :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
|