]> granicus.if.org Git - icu/commitdiff
ICU-8924 Add findbugs targets
authorAbhinav Gupta <mail@abhinavg.net>
Thu, 29 Dec 2011 18:13:00 +0000 (18:13 +0000)
committerAbhinav Gupta <mail@abhinavg.net>
Thu, 29 Dec 2011 18:13:00 +0000 (18:13 +0000)
X-SVN-Rev: 31176

icu4j/build.xml
icu4j/main/classes/charset/build.xml
icu4j/main/classes/collate/build.xml
icu4j/main/classes/core/build.xml
icu4j/main/classes/currdata/build.xml
icu4j/main/classes/langdata/build.xml
icu4j/main/classes/localespi/build.xml
icu4j/main/classes/regiondata/build.xml
icu4j/main/classes/translit/build.xml
icu4j/main/shared/build/common-targets.xml
icu4j/main/shared/build/common.properties

index b0e7c2b757d509f2b77b071c922561e6abc609df..621ba8d08ed2798c6fbde73bafe4185619d3c581 100644 (file)
     <target name="tests" depends="info, core-tests, charset-tests, collate-tests, packaging-tests, translit-tests, localespi-tests" description="Build ICU4J test classes"/>
     <target name="release" depends="info, releaseBinaries, releaseSrcJars, releaseDocs, releaseSourceArchiveTgz" description="Build all ICU4J release files for distribution"/>
 
+    <target name="findbugs" depends="charset-findbugs, collate-findbugs, core-findbugs, currdata-findbugs, langdata-findbugs, localespi-findbugs, regiondata-findbugs, translit-findbugs" description="Run FindBugs on all projects." />
+
     <target name="secure" depends="icu4jJar" description="(Deprecated)Build ICU4J API and test classes for running the ICU4J test suite with Java security manager enabled"/>
     
     <!-- Check to see if JVM_OPTIONS enviroment variable is set. This can be use to set the heap size. -->
         <delete file="${icu4jsrc.tar}"/>
     </target>
 
+    <!-- findbugs targets -->
+
+    <target name="core-findbugs" description="Find bugs in core">
+        <ant dir="${icu4j.core.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="collate-findbugs" description="Find bugs in collate">
+        <ant dir="${icu4j.collate.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="charset-findbugs" description="Find bugs in charset">
+        <ant dir="${icu4j.charset.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="currdata-findbugs" description="Find bugs in currdata">
+        <ant dir="${icu4j.currdata.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="langdata-findbugs" description="Find bugs in langdata">
+        <ant dir="${icu4j.langdata.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="localespi-findbugs" description="Find bugs in localespi">
+        <ant dir="${icu4j.localespi.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="regiondata-findbugs" description="Find bugs in regiondata">
+        <ant dir="${icu4j.regiondata.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
+    <target name="translit-findbugs" description="Find bugs in translit">
+        <ant dir="${icu4j.translit.dir}" inheritAll="false" target="findbugs" />
+    </target>
+
     <!-- compile targets -->
     <target name="core" description="Build core classes">
         <ant dir="${icu4j.core.dir}" inheritAll="false"/>
index aef033dba0556f12bc9b5a0de79db67f153e0926..f4754e5f1f375f828723631316d26c15ddc6a8fd 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU core data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset>
@@ -38,4 +40,4 @@
         </unjar>
     </target>
 
-</project>
\ No newline at end of file
+</project>
index db8a9ea4d43fbf4c629b83d82fc632be02b497d4..b9d51db2089a1dd0480a776d3b31a89a8d85cdaa 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU collation data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset includes="${icu4j.data.path}/coll/**"/>
index be3dfe8bc604ec1311a8f4bc655c86c03b21b0b3..76aa16665320396a518dc6cbc40c38c1d2167f77 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU core data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset>
index b3a00fce0921baec17be49ed3536ed897d7b437f..8c77e9ce00a94ad6c012da3085e0c0ee14a3ceed 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU currency data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset includes="${icu4j.data.path}/curr/**"/>
index 0c91a7ab02ccd2217b9461936a195e2510ca04dc..ef251050affabc458a2f201b7de6126b97fe9cb7 100644 (file)
@@ -30,6 +30,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU language data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset includes="${icu4j.data.path}/lang/**"/>
index 1d1d27297f4df95941ddc834b67fea431457ce9b..b415adcb3959ae78cdd6fb030dcea1d3e3c90983 100644 (file)
@@ -28,4 +28,6 @@
     <target name="jar" depends="compile, copy, @jar" description="Create the project's jar file"/>
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
-</project>
\ No newline at end of file
+
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+</project>
index 84fb3e966b5039ceb41e024b22a86f22f9624e56..4b664d113b64888450d72baf412e5bf53c3ae641 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU region data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset includes="${icu4j.data.path}/region/**"/>
index 8e475ca3006a160ad2e73a11a151f2f884b7861b..92eb0e92651b91ddd4cf85b576e47a92e4769860 100644 (file)
@@ -29,6 +29,8 @@
 
     <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
 
+    <target name="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />
+
     <target name="copy-data" description="Extract pre-built ICU transliteration data files and copy them to the project's binary directory">
         <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
             <patternset includes="${icu4j.data.path}/translit/**"/>
index e63ccc8b7ef31a64df4a4665d0e41a5e3d8c5487..e13daef3bc1a5dccc8915b4d44d8ac8cffb9f5e8 100644 (file)
         <echo message="${full.locale.names}" file="${res.dir}/fullLocaleNames.lst"/>
     </target>
 
+    <!-- fail if findbugs.home is not given or the findbugs task is
+         unavailable -->
+    <target name="_findbugs_check">
+        <fail message="findbugs.home must be defined.">
+            <condition>
+                <not>
+                    <available file="${findbugs.home}" type="dir" />
+                </not>
+            </condition>
+        </fail>
+        <fail message="FindBugs task not found">
+            <condition>
+                <not>
+                    <or>
+                        <available classname="edu.umd.cs.findbugs.anttask.FindBugsTask" property="_findbugs.task.available" />
+                        <available file="${findbugs.home}/lib/findbugs-ant.jar" />
+                    </or>
+                </not>
+            </condition>
+        </fail>
+    </target>
+
+    <!-- if findbugs-ant.jar is already on the path, just define the task -->
+    <target name="_findbugs_task_available" depends="_findbugs_check" if="_findbugs.task.available">
+        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
+    </target>
+
+    <!-- otherwise, specify findbugs-ant.jar on the path -->
+    <target name="_findbugs_task_unavailable" depends="_findbugs_check" unless="_findbugs.task.available">
+        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+            classpath="${findbugs.home}/lib/findbugs-ant.jar" />
+    </target>
+
+    <target name="_findbugs_task" depends="_findbugs_task_available, _findbugs_task_unavailable" />
+
+    <target name="@findbugs" depends="_findbugs_task, @build-all">
+        <findbugs home="${findbugs.home}" output="html" outputFile="${out.dir}/fb-${ant.project.name}.html">
+            <sourcePath path="${src.dir}" />
+            <class location="${jar.dir}/${jar.name}" />
+            <auxClasspath path="${toString:javac.classpathref}" />
+        </findbugs>
+    </target>
+
     <!-- Dependencies -->
 
     <!-- collate -->
index 72dbeb5e4cfc9e012e2c062e2cbe18e88b399512..cbd5b23aaa8f03a2ed29b0a561398c967f755533 100644 (file)
@@ -62,3 +62,6 @@ icu4j.samples.jar = ${icu4j.samples.dir}/${jar.dir}/icu4j-samples.jar
 
 # Misc
 icu4j.data.path = com/ibm/icu/impl/data/icudt${icu4j.data.version}b
+
+# Findbugs
+findbugs.home =