ICU-8957 Updated ant build files supporting findbugs invoked from ant build.

X-SVN-Rev: 33539
This commit is contained in:
Yoshito Umaoka 2013-04-19 23:31:32 +00:00
parent f2fbc8c394
commit d240d6478b
3 changed files with 60 additions and 57 deletions

View File

@ -149,8 +149,6 @@
<target name="main" depends="info, core, collate, charset, currdata, langdata, regiondata, translit, localespi" description="Build ICU4J runtime library classes"/>
<target name="tests" depends="info, core-tests, charset-tests, collate-tests, packaging-tests, translit-tests, localespi-tests" description="Build ICU4J test classes"/>
<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. -->
@ -601,36 +599,34 @@
<!-- findbugs targets -->
<target name="core-findbugs" description="Find bugs in core">
<ant dir="${icu4j.core.dir}" inheritAll="false" target="findbugs" />
</target>
<target name="findbugs" description="Run FindBugs on all library sub projects.">
<property name="findbugs.out.dir" value="${out.dir}/findbugs"/>
<mkdir dir="${findbugs.out.dir}"/>
<target name="collate-findbugs" description="Find bugs in collate">
<ant dir="${icu4j.collate.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.core.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.core.dir}/${out.dir}/fb-core.html" todir="${findbugs.out.dir}"/>
<target name="charset-findbugs" description="Find bugs in charset">
<ant dir="${icu4j.charset.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.collate.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.collate.dir}/${out.dir}/fb-collate.html" todir="${findbugs.out.dir}"/>
<target name="currdata-findbugs" description="Find bugs in currdata">
<ant dir="${icu4j.currdata.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.currdata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.currdata.dir}/${out.dir}/fb-currdata.html" todir="${findbugs.out.dir}"/>
<target name="langdata-findbugs" description="Find bugs in langdata">
<ant dir="${icu4j.langdata.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.langdata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.langdata.dir}/${out.dir}/fb-langdata.html" todir="${findbugs.out.dir}"/>
<target name="localespi-findbugs" description="Find bugs in localespi">
<ant dir="${icu4j.localespi.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.regiondata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.regiondata.dir}/${out.dir}/fb-regiondata.html" todir="${findbugs.out.dir}"/>
<target name="regiondata-findbugs" description="Find bugs in regiondata">
<ant dir="${icu4j.regiondata.dir}" inheritAll="false" target="findbugs" />
</target>
<ant dir="${icu4j.translit.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.translit.dir}/${out.dir}/fb-translit.html" todir="${findbugs.out.dir}"/>
<target name="translit-findbugs" description="Find bugs in translit">
<ant dir="${icu4j.translit.dir}" inheritAll="false" target="findbugs" />
<ant dir="${icu4j.charset.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.charset.dir}/${out.dir}/fb-charset.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.localespi.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.localespi.dir}/${out.dir}/fb-localespi.html" todir="${findbugs.out.dir}"/>
</target>
<!-- compile targets -->

View File

@ -1,6 +1,6 @@
<!--
*******************************************************************************
* Copyright (C) 2009-2012, International Business Machines Corporation and *
* Copyright (C) 2009-2013, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
-->
@ -104,17 +104,14 @@
<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">
<!-- FindBugs targets -->
<target name="_findbugs_init">
<property name="findbugs.home" value="${env.FINDBUGS_HOME}"/>
<echo message="----------------------------------------------------"/>
<echo message="findbugs.home: ${findbugs.home}"/>
<echo message="----------------------------------------------------"/>
<fail message="FindBugs task not found. Set environment variable FINDBUGS_HOME properly.">
<condition>
<not>
<or>
@ -124,29 +121,42 @@
</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" />
classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
<property name="aux.classpath" value="${toString:javac.classpathref}"/>
<condition property="empty.aux.classpath">
<length string="${aux.classpath}" when="eq" length="0"/>
</condition>
</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}" />
<target name="_findbugs_empty_aux_classpath" if="empty.aux.classpath">
<findbugs
home="${findbugs.home}"
output="html"
outputFile="${out.dir}/fb-${ant.project.name}.html"
excludeFilter="findbugs-exclude.xml">
<sourcePath path="${src.dir}"/>
<class location="${jar.dir}/${jar.name}"/>
</findbugs>
</target>
<target name="_findbugs_non_empty_aux_classpath" unless="empty.aux.classpath">
<findbugs
home="${findbugs.home}"
output="html"
outputFile="${out.dir}/fb-${ant.project.name}.html"
excludeFilter="findbugs-exclude.xml">
<sourcePath path="${src.dir}"/>
<class location="${jar.dir}/${jar.name}"/>
<auxClasspath path="${aux.classpath}"/>
</findbugs>
</target>
<target name="@findbugs" depends="_findbugs_init, @build-all, _findbugs_empty_aux_classpath, _findbugs_non_empty_aux_classpath"/>
<!-- Dependencies -->
<!-- collate -->

View File

@ -62,6 +62,3 @@ 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 =