91ea8e91e4
Closes #32287. Signed-off-by: Chongyu Zhu <i@lembacon.com>
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
class Spotbugs < Formula
|
|
desc "Tool for Java static analysis (FindBugs's successor)"
|
|
homepage "https://spotbugs.github.io/"
|
|
url "https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/3.1.7/spotbugs-3.1.7.tgz"
|
|
sha256 "7ac3a2c4c1ed29eb59926d02b92b1a35acc09610da4170f3aacf09a99d341132"
|
|
|
|
head do
|
|
url "https://github.com/spotbugs/spotbugs.git"
|
|
|
|
depends_on "gradle" => :build
|
|
end
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on :java => "1.8+"
|
|
|
|
def install
|
|
if build.head?
|
|
system "gradle", "build"
|
|
system "gradle", "installDist"
|
|
libexec.install Dir["spotbugs/build/install/spotbugs/*"]
|
|
else
|
|
libexec.install Dir["*"]
|
|
end
|
|
bin.install_symlink "#{libexec}/bin/spotbugs"
|
|
end
|
|
|
|
test do
|
|
(testpath/"HelloWorld.java").write <<~EOS
|
|
public class HelloWorld {
|
|
private double[] myList;
|
|
public static void main(String[] args) {
|
|
System.out.println("Hello World");
|
|
}
|
|
public double[] getList() {
|
|
return myList;
|
|
}
|
|
}
|
|
EOS
|
|
system "javac", "HelloWorld.java"
|
|
system "jar", "cvfe", "HelloWorld.jar", "HelloWorld", "HelloWorld.class"
|
|
output = shell_output("#{bin}/spotbugs -textui HelloWorld.jar")
|
|
assert_match /M V EI.*\nM C UwF.*\n/, output
|
|
end
|
|
end
|