From c213c078594ff03e3b9a28206d8033b6080bd2cd Mon Sep 17 00:00:00 2001
From: Charles Parker <ctparker@lbl.gov>
Date: Thu, 19 May 2016 14:25:46 +0000
Subject: [PATCH] Added findbugs support.

---
 build.xml | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/build.xml b/build.xml
index 1a49700..ce683ce 100644
--- a/build.xml
+++ b/build.xml
@@ -39,8 +39,10 @@
     <property name="test.report.dir" location="${report.dir}/junit" />
     <property name="cobertura.report.dir" location="${report.dir}/cobertura" />
     <property name="checkstyle.report.dir" location="${report.dir}/checkstyle" />
-
     <property name="cloc.report.dir" location="${report.dir}/cloc" />
+    <property name="findbugs.report.dir" location="${report.dir}/findbugs" />
+
+    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
 
     <description>Build script for ${project.title} (Java ${target.version}).</description>
 
@@ -244,7 +246,27 @@
 
     </target>
 
+    <!-- run findbugs against the compiled library -->
+    <target name="findbugs" depends="dist">
+
+        <mkdir dir="${findbugs.report.dir}" />
+        <property name="findbugs.report.file" location="${findbugs.report.dir}/findbugs.xml" />
+
+        <findbugs output="xml" outputFile="${findbugs.report.file}">
+
+            <classpath>
+                <path refid="test.path" />
+            </classpath>
+
+            <auxClasspath refid="runtime.path" />
+            <sourcePath path="${src.dir}" />
+            <class location="${dist.dir}/${project.artifact}.jar" />
+
+        </findbugs>
+
+    </target>
+
     <!-- Generate the distribution and run integration tests. -->
-    <target name="integration" depends="dist, test, cloc" description="Generate the distribution and run integration tests." />
+    <target name="integration" depends="dist, test, cloc, findbugs" description="Generate the distribution and run integration tests." />
 
 </project>
-- 
GitLab