spotbugs 3.1.0 and rename from findbugs (#19886)

This commit is contained in:
Stephen 2017-11-18 02:41:41 -08:00 committed by ilovezfs
parent 9b0bea1519
commit a1a1070d33
4 changed files with 47 additions and 34 deletions

1
Aliases/findbugs Symbolic link
View file

@ -0,0 +1 @@
../Formula/spotbugs.rb

View file

@ -1,34 +0,0 @@
class Findbugs < Formula
desc "Find bugs in Java programs through static analysis"
homepage "https://findbugs.sourceforge.io"
url "https://downloads.sourceforge.net/project/findbugs/findbugs/3.0.1/findbugs-3.0.1.tar.gz"
sha256 "e80e0da0c213a27504ef3188ef25f107651700ffc66433eac6a7454bbe336419"
bottle :unneeded
depends_on :java => "1.7+"
conflicts_with "fb-client",
:because => "findbugs and fb-client both install a `fb` binary"
def install
# Remove windows files
rm_f Dir["bin/*.bat"]
prefix.install_metafiles
libexec.install Dir["*"]
bin.write_exec_script libexec/"bin/fb"
bin.write_exec_script libexec/"bin/findbugs"
end
def caveats; <<~EOS
Some tools might refer findbugs by env variable.
After installation, set $FINDBUGS_HOME in your profile:
export FINDBUGS_HOME=#{libexec}
EOS
end
test do
system "#{bin}/fb"
end
end

45
Formula/spotbugs.rb Normal file
View file

@ -0,0 +1,45 @@
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.0/spotbugs-3.1.0.tgz"
sha256 "c1eab4dc50cd9854c83fc4a90b4a9b9c63e5307bd0f0f7bb04720e17153b629c"
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

View file

@ -40,6 +40,7 @@
"fbida": "exiftran", "fbida": "exiftran",
"ffmpeg28": "ffmpeg@2.8", "ffmpeg28": "ffmpeg@2.8",
"fig": "docker-compose", "fig": "docker-compose",
"findbugs": "spotbugs",
"freetds091": "freetds@0.91", "freetds091": "freetds@0.91",
"gcc46": "gcc@4.6", "gcc46": "gcc@4.6",
"gcc47": "gcc@4.7", "gcc47": "gcc@4.7",