You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2010/07/07 07:21:40 UTC

svn commit: r961246 - /ant/ivy/core/trunk/build.xml

Author: jhm
Date: Wed Jul  7 05:21:40 2010
New Revision: 961246

URL: http://svn.apache.org/viewvc?rev=961246&view=rev
Log:
Add "rat" and "findbugs" targets. Copied from Ant's check.xml buildfile and slightly modified for Ivy.

Modified:
    ant/ivy/core/trunk/build.xml

Modified: ant/ivy/core/trunk/build.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/build.xml?rev=961246&r1=961245&r2=961246&view=diff
==============================================================================
--- ant/ivy/core/trunk/build.xml (original)
+++ ant/ivy/core/trunk/build.xml Wed Jul  7 05:21:40 2010
@@ -580,7 +580,102 @@
         </xslt>
     </target>
     
+    <target name="rat" description="runs the ReleaseAuditingTool"  depends="init-ivy">
+        <property name="rat.report.dir"
+                  value="${reports.dir}/rat"
+                  description="Where to store the RAT reports"/>
+        <property name="rat.report.file"
+                  value="${rat.report.dir}/report.html"
+                  description="RAT-Report file"/>
+        <property name="rat.version"
+                  value="0.6"
+                  description="Which Version of RAT to use"/>
+        <ivy:cachepath organisation="org.apache.rat" module="apache-rat-tasks" revision="${rat.version}"
+                       inline="true" conf="default" pathid="rat.classpath" transitive="true"/>
+        <typedef resource="org/apache/rat/anttasks/antlib.xml"
+                 uri="antlib:org.apache.rat.anttasks"
+                 classpathref="rat.classpath"/>
+        <mkdir dir="${rat.report.dir}"/>
+        <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportfile="${rat.report.dir}/report.txt">
+            <fileset dir="${src.dir}">
+                <include name="**/*.java" />
+            </fileset>
+            <fileset dir="${example.dir}">
+                <include name="**/*.java" />
+            </fileset>
+        </rat:report>
+    </target>
+
+    <target name="init-findbugs" unless="findbugs.home">
+        <!-- Findbugs: Getting Findbugs -->
+        <property name="findbugs.download.name" 
+                  value="findbugs-1.3.5"
+                  description="Name of the download file without suffix. Also the internal root directory of the ZIP."/>
+        <property name="findbugs.download.file" 
+                  value="${findbugs.download.name}.zip"
+                  description="The filename of the ZIP."/>
+        <property name="findbugs.download.url"  
+                  value="http://garr.dl.sourceforge.net/sourceforge/findbugs/${findbugs.download.file}"
+                  description="The download adress at a mirror of Sourceforge."/>
+        <property name="findbugs.download.to"   
+                  value=".downloads"
+                  description="Where to store the download and 'install' Findbugs."/>
+        <available 
+          property="findbugs.home" 
+          value="${findbugs.download.to}/${findbugs.download.name}"
+          file="${findbugs.download.to}/${findbugs.download.name}/lib/findbugs.jar"
+          description="Check if Findbugs is already installed."
+        />
+      
+        <!-- Findbugs: Running Findbugs -->
+        <property name="findbugs.reportdir" 
+                  location="${reports.dir}/findbugs" 
+                  description="Where to store Findbugs results"/>
+        <property name="findbugs.raw"       
+                  value="raw.xml" 
+                  description="Findbugs Output xml-file"/>
+        <property name="findbugs.xsl"       
+                  value="fancy.xsl" 
+                  description="Which XSL to use for generating Output: default, fancy, plain, summary"/>
+        <property name="findbugs.jvmargs"   
+                  value="-Xms128m -Xmx512m" 
+                  description="JVMArgs for invoking Findbugs"/>
 
+        <mkdir dir="${findbugs.download.to}"/>
+        <get src="${findbugs.download.url}" dest="${findbugs.download.to}/${findbugs.download.file}"/>
+        <unzip src="${findbugs.download.to}/${findbugs.download.file}" dest="${findbugs.download.to}"/>
+        <property name="findbugs.home" location="${findbugs.download.to}/${findbugs.download.name}"/>
+        <mkdir dir="${findbugs.home}/plugin"/>
+    </target>
+  
+    <target name="findbugs" description="checks Ivy codebase with Findbugs" depends="init-findbugs,compile-core" xmlns:fb="http://findbugs.sourceforge.net/">
+        <path id="findbugs.real.classpath">
+           <fileset dir="${findbugs.home}/lib" includes="*.jar"/>
+        </path>
+    
+        <!-- Load the Findbugs AntTasks -->               
+        <taskdef uri="http://findbugs.sourceforge.net/" resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpathref="findbugs.real.classpath" />
+            
+        <!-- Start Findbugs -->
+        <mkdir dir="${findbugs.reportdir}"/>
+        <fb:findbugs home="${findbugs.home}"
+                     classpathref="findbugs.real.classpath"
+                     output="xml:withMessages"
+                     outputFile="${findbugs.reportdir}/${findbugs.raw}"
+                     jvmargs="${findbugs.jvmargs}"
+                     projectName="${Name} ${project.version}">
+            <class location="${core.classes.build.dir}" />
+            <sourcePath path="${src.dir}" />
+        </fb:findbugs>
+        
+        <!-- Generate (human) readable output -->
+        <xslt basedir="${findbugs.reportdir}" includes="${findbugs.raw}" destdir="${findbugs.reportdir}">
+            <style>
+                <javaresource name="${findbugs.xsl}" classpathref="findbugs.real.classpath"/>
+            </style>  
+        </xslt>
+    </target>
+ 
     <!-- =================================================================
          IDE SPECIFIC
          ================================================================= -->