class ClosureCompiler < Formula desc "JavaScript optimizing compiler" homepage "https://developers.google.com/closure/compiler" url "https://search.maven.org/remotecontent?filepath=com/google/javascript/closure-compiler/v20230103/closure-compiler-v20230103.jar" sha256 "1a01b340ae45cd5d6c4e67bd7f31fdbc0c9aad33edaa50ef34f8d75ee3de17c6" license "Apache-2.0" livecheck do url "https://search.maven.org/remotecontent?filepath=com/google/javascript/closure-compiler/" regex(/href=.*?v?(\d{8})/i) end bottle do sha256 cellar: :any_skip_relocation, all: "ec261f424ee37f687cc577152c76a954dfaec674d81f78a6386f5be6096e7cc8" end depends_on "openjdk" def install libexec.install Dir["*"] bin.write_jar_script libexec/"closure-compiler-v#{version}.jar", "closure-compiler" end test do (testpath/"test.js").write <<~EOS (function(){ var t = true; return t; })(); EOS system bin/"closure-compiler", "--js", testpath/"test.js", "--js_output_file", testpath/"out.js" assert_equal (testpath/"out.js").read.chomp, "(function(){return!0})();" end end