Author: gates
Date: Fri Oct 23 19:59:53 2009
New Revision: 829195

URL: http://svn.apache.org/viewvc?rev=829195&view=rev
Log:
PIG-996 Add findbugs, checkstyle, and clover to zebra build file.

Modified:
    hadoop/pig/trunk/contrib/zebra/CHANGES.txt
    hadoop/pig/trunk/contrib/zebra/build-contrib.xml
    hadoop/pig/trunk/contrib/zebra/build.xml

Modified: hadoop/pig/trunk/contrib/zebra/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/CHANGES.txt?rev=829195&r1=829194&r2=829195&view=diff
==============================================================================
--- hadoop/pig/trunk/contrib/zebra/CHANGES.txt (original)
+++ hadoop/pig/trunk/contrib/zebra/CHANGES.txt Fri Oct 23 19:59:53 2009
@@ -6,6 +6,9 @@
 
   IMPROVEMENTS
        
+       PIG-996 Add findbugs, checkstyle, and clover to zebra build file (chaow 
via
+               gates)
+
        PIG-993 Ability to drop a column group in a table (yanz and rangadi via 
gates)
 
     PIG-992 Separate schema related files into a schema package (yanz via

Modified: hadoop/pig/trunk/contrib/zebra/build-contrib.xml
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/build-contrib.xml?rev=829195&r1=829194&r2=829195&view=diff
==============================================================================
--- hadoop/pig/trunk/contrib/zebra/build-contrib.xml (original)
+++ hadoop/pig/trunk/contrib/zebra/build-contrib.xml Fri Oct 23 19:59:53 2009
@@ -61,6 +61,18 @@
   <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
   <property name="ivy.lib.dir" location="${build.ivy.lib.dir}/Pig"/>
 
+  <property name="clover.db.dir" location="${build.dir}/test/clover/db"/>
+    <property name="clover.report.dir" 
location="${build.dir}/test/clover/reports"/>
+    <property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
+    <available property="clover.present" file="${clover.jar}" />
+    <!-- check if clover reports should be generated -->
+    <condition property="clover.enabled">
+      <and>
+        <isset property="run.clover"/>
+        <isset property="clover.present"/>
+      </and>
+    </condition>
+
   <!-- javacc properties -->
   <property name="src.gen.dir" value="${basedir}/src-gen/" />
   <property name="src.gen.zebra.parser.dir" 
value="${src.gen.dir}/org/apache/hadoop/zebra/parser" />
@@ -107,6 +119,7 @@
     <pathelement location="${conf.dir}"/>
     <pathelement location="${pig.root}/build"/>
     <pathelement location="${build.examples}"/>
+       <pathelement path="${clover.jar}"/>
     <path refid="classpath"/>
   </path>
 
@@ -235,48 +248,6 @@
       </fileset>
     </copy>
   </target>
- 
-  <!-- ================================================================== -->
-  <!-- Run unit tests                                                     -->
-  <!-- ================================================================== -->
-  <target name="test" depends="compile-test, compile" if="test.available">
-    <echo message="contrib: ${name}"/>
-    <delete dir="${pig.log.dir}"/>
-    <mkdir dir="${pig.log.dir}"/>
-    <junit
-      printsummary="yes" showoutput="${test.output}" 
-      haltonfailure="no" fork="yes" maxmemory="256m"
-      errorProperty="tests.failed" failureProperty="tests.failed"
-      timeout="${test.timeout}">
-      
-      <sysproperty key="test.build.data" value="${build.test}/data"/>
-      <sysproperty key="build.test" value="${build.test}"/>
-      <sysproperty key="contrib.name" value="${name}"/>
-      <sysproperty key="hadoop.log.dir" value="${pig.log.dir}"/>
-      
-      <!-- requires fork=yes for: 
-        relative File paths to use the specified user.dir 
-        classpath to use build/contrib/*.jar
-      -->
-      <sysproperty key="user.dir" value="${build.test}/data"/>
-      
-      <sysproperty key="fs.default.name" value="${fs.default.name}"/>
-      <sysproperty key="pig.test.localoutputfile" 
value="${pig.test.localoutputfile}"/>
-      <sysproperty key="pig.log.dir" value="${pig.log.dir}"/> 
-      <classpath refid="test.classpath"/>
-      <formatter type="${test.junit.output.format}" />
-
-      <batchtest todir="${build.test}" unless="testcase">
-        <fileset dir="${src.test}"
-                 includes="**/Test*.java" excludes="**/${test.exclude}.java" />
-      </batchtest>
-      <batchtest todir="${build.test}" if="testcase">
-        <fileset dir="${src.test}" includes="**/${testcase}.java"/>
-      </batchtest>
-    </junit>
-    <fail if="tests.failed">Tests failed!</fail>
-
-  </target>
 
   <!-- ================================================================== -->
   <!-- Clean.  Delete the build files, and their directories              -->

Modified: hadoop/pig/trunk/contrib/zebra/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/contrib/zebra/build.xml?rev=829195&r1=829194&r2=829195&view=diff
==============================================================================
--- hadoop/pig/trunk/contrib/zebra/build.xml (original)
+++ hadoop/pig/trunk/contrib/zebra/build.xml Fri Oct 23 19:59:53 2009
@@ -24,10 +24,10 @@
 <project name="zebra" default="jar">
 
   <import file="build-contrib.xml"/>
-  <property name="zebraVersion" value="0.1.0" />
+  <property name="zebraVersion" value="0.2.0" />
 
   <!-- Override jar target to specify main class -->
-  <target name="jar" depends="compile">
+  <target name="jar" depends="compile" description="Build zebra jar">
     <jar
       jarfile="${build.dir}/${name}-${zebraVersion}.jar"
       basedir="${build.classes}"      
@@ -99,7 +99,7 @@
   <!-- ================================================================== -->
   <!-- Run checkin tests                                                  -->
   <!-- ================================================================== -->
-  <target name="test" depends="compile-test, compile" if="test.available">
+  <target name="test" depends="compile-test, compile" if="test.available" 
description="Run check-in test">
     <echo message="contrib: ${name}"/>
     <delete dir="${pig.log.dir}"/>
     <mkdir dir="${pig.log.dir}"/>
@@ -126,7 +126,7 @@
       <classpath refid="test.classpath"/>
       <formatter type="${test.junit.output.format}" />
 
-      <batchtest todir="${build.test}"  unless="testcase">
+      <batchtest todir="${build.test}" unless="testcase">
         <fileset dir="${src.test}"
                  includes="**/TestCheckin*.java" 
excludes="**/${test.exclude}.java" />
       </batchtest>
@@ -178,4 +178,106 @@
     <fail if="tests.failed">Tests failed!</fail>
   </target>
 
+  <!-- ================================================================== -->
+  <!-- findbugs                                                           -->
+  <!-- ================================================================== -->
+  <target name="findbugs" depends="check-for-findbugs, jar" 
if="findbugs.present" description="Run findbugs if present">
+      <property name="findbugs.out.dir" value="${build.dir}/findbugs"/>
+      <property name="findbugs.report.htmlfile" 
value="${findbugs.out.dir}/zebra-findbugs-report.html"/>
+      <property name="findbugs.report.xmlfile" 
value="${findbugs.out.dir}/zebra-findbugs-report.xml"/>
+      <taskdef name="findbugs" 
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
+              classpath="${findbugs.home}/lib/findbugs-ant.jar" />
+      <mkdir dir="${findbugs.out.dir}"/>
+      <findbugs home="${findbugs.home}" output="xml:withMessages"
+              outputFile="${findbugs.report.xmlfile}" effort="max" 
jvmargs="-Xmx512M">
+            <sourcePath path="${src.dir}"/>
+            <class location="${build.dir}" />
+      </findbugs>
+      <xslt style="${findbugs.home}/src/xsl/default.xsl" 
in="${findbugs.report.xmlfile}"
+              out="${findbugs.report.htmlfile}"/>
+  </target>
+  
+  <target name="check-for-findbugs">
+      <available property="findbugs.present" 
file="${findbugs.home}/lib/findbugs.jar" />
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- checkstyle                                                         -->
+  <!-- ================================================================== -->
+       <target name="checkstyle" depends="checkstyle.check, 
set-checkstyle-classpath" if="checkstyle.home"
+               description="Run optional third-party tool targets">
+      <property name="checkstyle.dir" value="${build.dir}/checkstyle"/>
+           <taskdef resource="checkstyletask.properties">
+               <classpath refid="classpath"/>
+               <classpath refid="checkstyle-classpath"/>
+           </taskdef>
+           <mkdir dir="${checkstyle.dir}"/>
+           <checkstyle config="${checkstyle.dir}/checkstyle.xml" 
failOnViolation="false">
+               <!--fileset dir="${src.dir}" includes="**/*.java" 
excludes="**/generated/**"/-->
+               <fileset dir="${src.dir}" includes="**/*.java"/>
+               <formatter type="xml" 
toFile="${checkstyle.dir}/checkstyle-errors.xml"/>
+           </checkstyle>
+           <xslt style="${checkstyle.dir}/checkstyle-noframes-sorted.xsl" 
in="${checkstyle.dir}/checkstyle-errors.xml"
+               out="${checkstyle.dir}/checkstyle-errors.html"/>
+       </target>
+       
+       <target name="checkstyle.check" unless="checkstyle.home">
+           <!--<fail message="'checkstyle.home' is not defined. Please pass 
-Dcheckstyle.home=&lt;base of checkstyle installation&gt; to Ant on the 
command-line." />-->
+           <echo>
+        Checkstyle not found. Checkstyle disabled.
+      </echo>
+       </target>
+       
+       <target name="set-checkstyle-classpath">
+           <path id="checkstyle-classpath">
+               <fileset dir="${checkstyle.home}">
+               <include name="**/*.jar"/>
+                </fileset>
+        </path>
+       </target>
+
+
+  <!-- ================================================================== -->
+  <!-- clover                                                             -->
+  <!-- ================================================================== -->
+  <target name="clover" depends="clover.setup, clover.info" 
description="Instrument the Unit tests using Clover.  
+          To use, specify -Dclover.home=&lt;base of clover installation&gt; 
-Drun.clover=true on the command line."/>
+
+  <target name="clover.setup" if="clover.enabled">
+       <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
+     <mkdir dir="${clover.db.dir}"/>
+     <clover-setup initString="${clover.db.dir}/zebra_coverage.db">
+       <fileset dir="src" includes="**/*.java"/>
+        </clover-setup>
+  </target>
+
+  <target name="clover.info" unless="clover.present">
+       <echo>
+       Clover not found. Code coverage reports disabled.
+       </echo>
+  </target>
+  
+  <target name="clover.check">
+    <fail unless="clover.present">
+      ##################################################################
+               Clover not found.
+               Please specify -Dclover.home=&lt;base of clover installation&gt;
+               on the command line.
+      ##################################################################
+         </fail>
+  </target>
+
+  <target name="generate-clover-reports" depends="clover.check, clover">
+       <mkdir dir="${clover.report.dir}"/>
+       <clover-report>
+               <current outfile="${clover.report.dir}" title="${final.name}">
+                       <format type="html"/>
+               </current>
+       </clover-report>
+  <clover-report>
+               <current outfile="${clover.report.dir}/clover.xml" 
title="${final.name}">
+                       <format type="xml"/>
+               </current>
+       </clover-report>
+  </target> 
 </project>


Reply via email to