Author: robbie
Date: Fri Jan  6 14:07:42 2012
New Revision: 1228192

URL: http://svn.apache.org/viewvc?rev=1228192&view=rev
Log:
QPID-3670: Add new build target to allow the Cobertura jar files to be 
downloaded automatically if not already present

Applied patch from Andrew MacBean <andymacb...@gmail.com>

Modified:
    qpid/trunk/qpid/java/common.xml
    qpid/trunk/qpid/java/lib/cobertura/README.txt

Modified: qpid/trunk/qpid/java/common.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common.xml?rev=1228192&r1=1228191&r2=1228192&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common.xml (original)
+++ qpid/trunk/qpid/java/common.xml Fri Jan  6 14:07:42 2012
@@ -61,6 +61,12 @@
   <property name="javac.compiler.args"   value=""/>
 
   <property name="cobertura.dir" value="${project.root}/lib/cobertura" />
+  <property name="cobertura.version" value="1.9.4.1" />
+  <property name="cobertura.download.url"
+            
value="http://downloads.sourceforge.net/project/cobertura/cobertura/${cobertura.version}/cobertura-${cobertura.version}-bin.zip";
 />
+  <property name="cobertura.zip.filename" 
value="cobertura-${cobertura.version}-bin.zip" />
+  <property name="cobertura.temp.dir" value="${cobertura.dir}"/>
+
   <property name="mllib.dir" value="${project.root}/../python" />
   <property name="findbugs.dir" value="${project.root}/lib/findbugs" />
 
@@ -71,8 +77,8 @@
 
   <path id="cobertura.classpath">
     <fileset dir="${cobertura.dir}">
-        <include name="cobertura.jar" />
-        <include name="lib/**/*.jar" />
+        <include name="cobertura-${cobertura.version}/*.jar" />
+        <include name="cobertura-${cobertura.version}/**/lib/*.jar" />
     </fileset>
   </path>
 
@@ -192,6 +198,22 @@
     <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
   </target>
 
+  <!--download Cobertura jar and expand-->
+  <target name="download-cobertura" description="download Cobertura if not 
already present" depends="cobertura-check" unless="cobertura.already.exists">
+      <mkdir dir="${cobertura.dir}"/>
+      <echo>Downloading Cobertura ${cobertura.version}</echo>
+      <get src="${cobertura.download.url}" 
dest="${cobertura.temp.dir}/${cobertura.zip.filename}" usetimestamp="false" />
+      <echo>Extracting Cobertura JAR and dependencies</echo>
+      <unzip src="${cobertura.temp.dir}/${cobertura.zip.filename}" 
dest="${cobertura.dir}"/>
+      <echo>Cleanup Cobertura Download</echo>
+      <delete file="${cobertura.temp.dir}/${cobertura.zip.filename}"/>
+      <echo>Done</echo>
+  </target>
+
+  <target name="cobertura-check">
+    <available property="cobertura.already.exists" 
file="${cobertura.dir}/cobertura-${cobertura.version}" type="dir"/>
+  </target>
+
   <target name="findbugs-init">
     <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"/>

Modified: qpid/trunk/qpid/java/lib/cobertura/README.txt
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/lib/cobertura/README.txt?rev=1228192&r1=1228191&r2=1228192&view=diff
==============================================================================
--- qpid/trunk/qpid/java/lib/cobertura/README.txt (original)
+++ qpid/trunk/qpid/java/lib/cobertura/README.txt Fri Jan  6 14:07:42 2012
@@ -1,10 +1,9 @@
-Download the cobertura binary from the following location:
+Download the cobertura binary from the following location and expand it into
+this directory.
 
 http://cobertura.sourceforge.net/download.html
 
-
-Unpack it into the cobertura (this) directory with tar --strip-path 1 -xf.
-This should leave you with cobertura.jar in qpid/java/lib/cobertura.
+Alternatively run "ant download-cobertura" to do this automatically.
+(to set a http proxy for ant use ANT_OPTS="-Dhttp.proxyHost=<host> 
-Dhttp.proxyPort=<port>")
 
 Run "ant cover-test coverage-report" to generate coverage report.
-



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to