summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-05-12 16:47:47 +0000
committerRobert Gemmell <robbie@apache.org>2012-05-12 16:47:47 +0000
commit30c12a0d7fb3855ff7d4b2fb8c5245f8b63a0ab8 (patch)
tree806addd5f1bc1074988e596990b3ccac0951d76c
parentd01c61b5f5178bccf7bd034e3270d1ade76e6c6e (diff)
downloadqpid-python-30c12a0d7fb3855ff7d4b2fb8c5245f8b63a0ab8.tar.gz
QPID-3994: add support for optionally retrieving FindBugs using Ivy
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1337590 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/build.xml14
-rw-r--r--qpid/java/common.xml44
-rw-r--r--qpid/java/ivy.retrieve.xml4
-rw-r--r--qpid/java/ivysettings.retrieve.xml4
-rw-r--r--qpid/java/lib/findbugs/README.txt30
5 files changed, 54 insertions, 42 deletions
diff --git a/qpid/java/build.xml b/qpid/java/build.xml
index 0905d650d4..4cf91340dc 100644
--- a/qpid/java/build.xml
+++ b/qpid/java/build.xml
@@ -270,7 +270,7 @@
</jython>
</target>
- <target name="findbugs" depends="findbugs-init,build">
+ <target name="findbugs" depends="build,findbugs-init">
<mkdir dir="${build.findbugs}"/>
@@ -280,13 +280,15 @@
stylesheet="fancy-hist.xsl"
jvmargs="-Xmx512m"
projectName="Qpid">
- <auxAnalyzePath>
- <fileset dir="${build.lib}" includes="qpid*.jar" excludes="*test*.jar *junit*.jar *example*.jar qpid-all.jar"/>
- </auxAnalyzePath>
+ <!-- The classes for analysis -->
+ <fileset dir="${build.lib}" includes="qpid*.jar" excludes="*test*.jar *-sources*.jar *example*.jar qpid-all.jar"/>
+
+ <!--Additional classes, not for analysis -->
<auxClassPath>
- <fileset dir="${build.lib}" includes="**/*.jar" />
- <fileset dir="${basedir}/lib" includes="org.eclipse*.jar com.ibm.*.jar"/>
+ <fileset dir="${basedir}/lib" includes="**/*.jar"/>
</auxClassPath>
+
+ <!-- Source, used for improved reporting -->
<sourcePath>
<fileset dir="${basedir}" includes="**/src/**/org/.." />
</sourcePath>
diff --git a/qpid/java/common.xml b/qpid/java/common.xml
index ea3b5849d0..319ca4c06d 100644
--- a/qpid/java/common.xml
+++ b/qpid/java/common.xml
@@ -126,6 +126,12 @@
<condition property="ivy.configured">
<isfalse value="${retrieve.dependencies}"/>
</condition>
+ <condition property="ivy.retrieve.optional">
+ <and>
+ <istrue value="${retrieve.dependencies}"/>
+ <istrue value="${optional.dependencies}"/>
+ </and>
+ </condition>
<macrodef name="indirect">
@@ -213,6 +219,21 @@
</sequential>
</macrodef>
+ <macrodef name="copytofile">
+ <attribute name="tofile"/>
+ <attribute name="dir"/>
+ <attribute name="include"/>
+ <attribute name="failOnError" default="false"/>
+ <sequential>
+ <copy tofile="@{tofile}" failOnError="@{failOnError}">
+ <fileset dir="@{dir}">
+ <include name="@{include}"/>
+ </fileset>
+ </copy>
+ </sequential>
+ </macrodef>
+
+
<target name="clean-tasks">
<delete dir="${tasks.classes}"/>
</target>
@@ -253,21 +274,40 @@
</target>
<target name="findbugs-init">
+
+ <mkdir dir="${findbugs.dir}"/>
+ <!-- Hack to make the FindBugs jars retrieved using Ivy work with the Ant Task,
+ because it expects certain jar names without versions like in the .zip release -->
+ <copytofile tofile="${findbugs.dir}/findbugs.jar" dir="${findbugs.dir}" include="findbugs-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/findbugs-ant.jar" dir="${findbugs.dir}" include="findbugs-ant-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/bcel.jar" dir="${findbugs.dir}" include="bcel-*.jar"/>
+ <copytofile tofile="${findbugs.dir}/annotations.jar" dir="${findbugs.dir}" include="annotations-?.*.*.jar"/>
+ <copytofile tofile="${findbugs.dir}/jsr305.jar" dir="${findbugs.dir}" include="jsr305-*.jar"/>
+ <copytofile tofile="${findbugs.dir}/jFormatString.jar" dir="${findbugs.dir}" include="jFormatString-*.jar"/>
+
<available file="${findbugs.dir}/findbugs-ant.jar" property="findbugs-ant.jar.present"/>
- <fail unless="findbugs-ant.jar.present" message="Please follow the instructions at ${findbugs.dir}/README.txt to configure FindBugs"/>
+ <fail unless="findbugs-ant.jar.present" message="FindBugs was not found. Please add -Doptional.dependencies=true to your build command to retrieve FindBugs"/>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.dir}/findbugs-ant.jar"/>
</target>
<!-- targets for downloading ivy and retrieving dependencies -->
- <target name="retrieve-dependencies" depends="load-ivy, configure-ivy" unless="${ivy.dont.retrieve}">
+ <target name="retrieve-dependencies" depends="load-ivy, configure-ivy, retrieve-optional-dependencies" unless="${ivy.dont.retrieve}">
<echo message="Resolving and retrieving dependencies..."/>
<ivy:resolve type="jar,bundle" file="${project.root}/ivy.retrieve.xml" conf="required"/>
<ivy:retrieve type="jar,bundle" conf="required" sync="true"
pattern="${project.root}/lib/required/[artifact]-[revision].[ext]" />
</target>
+ <target name="retrieve-optional-dependencies" if="${ivy.retrieve.optional}">
+ <echo message="Resolving and retrieving optional dependencies..."/>
+ <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="findbugs"/>
+ <ivy:retrieve type="jar" conf="findbugs" sync="true"
+ pattern="${findbugs.dir}/[artifact]-[revision].[ext]" />
+ </target>
+
+
<target name="configure-ivy" unless="${ivy.configured}">
<ivy:configure file="${project.root}/ivysettings.retrieve.xml" override="true"/>
<property name="ivy.configured" value="true" />
diff --git a/qpid/java/ivy.retrieve.xml b/qpid/java/ivy.retrieve.xml
index 7facdf4e50..b2bd94bf6e 100644
--- a/qpid/java/ivy.retrieve.xml
+++ b/qpid/java/ivy.retrieve.xml
@@ -20,11 +20,12 @@
<info organisation="${ivy.organisation}" module="${project.name}" revision="${project.version}"/>
- <configurations defaultconf="required" defaultconfmapping="required->default;bdbje->default;jfree->default;csvjdbc->default">
+ <configurations defaultconf="required" defaultconfmapping="*->default">
<conf name="required"/>
<conf name="bdbje"/>
<conf name="jfree"/>
<conf name="csvjdbc"/>
+ <conf name="findbugs"/>
</configurations>
<publications xmlns:e="urn:ant.apache.org:ivy-extras"/>
@@ -67,5 +68,6 @@
<dependency org="jfree" name="jfreechart" rev="1.0.13" transitive="false" conf="jfree"/>
<dependency org="jfree" name="jcommon" rev="1.0.16" transitive="false" conf="jfree"/>
<dependency org="net.sourceforge.csvjdbc" name="csvjdbc" rev="1.0.8" transitive="false" conf="csvjdbc"/>
+ <dependency org="com.google.code.findbugs" name="findbugs-ant" rev="2.0.0" conf="findbugs"/>
</dependencies>
</ivy-module>
diff --git a/qpid/java/ivysettings.retrieve.xml b/qpid/java/ivysettings.retrieve.xml
index bdce28d007..8faf23c2d1 100644
--- a/qpid/java/ivysettings.retrieve.xml
+++ b/qpid/java/ivysettings.retrieve.xml
@@ -26,9 +26,7 @@
<artifact pattern="${ivy.localfs.root}/${ivy.localfs.pattern}" />
</filesystem>
- <url name="m2repo" m2compatible="true">
- <artifact pattern="${ivy.m2repo.url}/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
- </url>
+ <ibiblio name="m2repo" m2compatible="true" root="${ivy.m2repo.url}"/>
<url name="csvjdbc" m2compatible="true">
<artifact pattern="http://csvjdbc.sourceforge.net/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
diff --git a/qpid/java/lib/findbugs/README.txt b/qpid/java/lib/findbugs/README.txt
deleted file mode 100644
index 56343d7e63..0000000000
--- a/qpid/java/lib/findbugs/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Download the FindBugs archive from the following location:
-http://findbugs.sourceforge.net/downloads.html
-
-Unpack the contents of the 'findbugs-<version>/lib' folder within the archive
-to the 'qpid/java/lib/findbugs' (i.e. this) directory. This should leave you
-with contents of 'qpid/java/lib/findbugs' similar to:
-
-annotations.jar
-ant.jar
-asm-3.1.jar
-asm-analysis-3.1.jar
-asm-commons-3.1.jar
-asm-tree-3.1.jar
-asm-util-3.1.jar
-asm-xml-3.1.jar
-bcel.jar
-buggy.icns
-commons-lang-2.4.jar
-dom4j-1.6.1.jar
-findbugs-ant.jar
-findbugs.jar
-jFormatString.jar
-jaxen-1.1.1.jar
-jdepend-2.9.jar
-jsr305.jar
-mysql-connector-java-5.1.7-bin.jar
-
-
-Now simply run "ant findbugs" in qpid/java to generate the report.
-