29 lines
1.2 KiB
Ruby
29 lines
1.2 KiB
Ruby
class GoogleJavaFormat < Formula
|
|
desc "Reformats Java source code to comply with Google Java Style"
|
|
homepage "https://github.com/google/google-java-format"
|
|
url "https://github.com/google/google-java-format/releases/download/v1.11.0/google-java-format-1.11.0-all-deps.jar"
|
|
sha256 "2a5273633c2b1c1607b60b5e17671e6a535dedbcdef74a127629a027297ab7c7"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "3fc42b7dadb269a82002fe663bbac560e87c9e9500a92e8b1a3a9053582161cb"
|
|
end
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install "google-java-format-#{version}-all-deps.jar" => "google-java-format.jar"
|
|
bin.write_jar_script libexec / "google-java-format.jar", "google-java-format",
|
|
"--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
|
|
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
|
|
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
|
|
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
|
|
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
|
|
end
|
|
|
|
test do
|
|
(testpath/"foo.java").write "public class Foo{\n}\n"
|
|
assert_match "public class Foo {}", shell_output("#{bin}/google-java-format foo.java")
|
|
end
|
|
end
|