From a1a1070d333e197b35de4b04f0db304e0885c7cc Mon Sep 17 00:00:00 2001 From: Stephen Date: Sat, 18 Nov 2017 02:41:41 -0800 Subject: [PATCH] spotbugs 3.1.0 and rename from findbugs (#19886) --- Aliases/findbugs | 1 + Formula/findbugs.rb | 34 --------------------------------- Formula/spotbugs.rb | 45 ++++++++++++++++++++++++++++++++++++++++++++ formula_renames.json | 1 + 4 files changed, 47 insertions(+), 34 deletions(-) create mode 120000 Aliases/findbugs delete mode 100644 Formula/findbugs.rb create mode 100644 Formula/spotbugs.rb diff --git a/Aliases/findbugs b/Aliases/findbugs new file mode 120000 index 0000000000..30fe3290ee --- /dev/null +++ b/Aliases/findbugs @@ -0,0 +1 @@ +../Formula/spotbugs.rb \ No newline at end of file diff --git a/Formula/findbugs.rb b/Formula/findbugs.rb deleted file mode 100644 index 46f941cfe9..0000000000 --- a/Formula/findbugs.rb +++ /dev/null @@ -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 diff --git a/Formula/spotbugs.rb b/Formula/spotbugs.rb new file mode 100644 index 0000000000..87b5ea392c --- /dev/null +++ b/Formula/spotbugs.rb @@ -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 diff --git a/formula_renames.json b/formula_renames.json index 1a5f6efc19..3b1bb72188 100644 --- a/formula_renames.json +++ b/formula_renames.json @@ -40,6 +40,7 @@ "fbida": "exiftran", "ffmpeg28": "ffmpeg@2.8", "fig": "docker-compose", + "findbugs": "spotbugs", "freetds091": "freetds@0.91", "gcc46": "gcc@4.6", "gcc47": "gcc@4.7",