<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"/>
<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>
</unjar>
</target>
-</project>
\ No newline at end of file
+</project>
<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/**"/>
<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>
<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/**"/>
<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/**"/>
<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>
<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/**"/>
<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/**"/>
<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 -->
# Misc
icu4j.data.path = com/ibm/icu/impl/data/icudt${icu4j.data.version}b
+
+# Findbugs
+findbugs.home =