You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ec...@apache.org on 2012/06/10 03:29:35 UTC

svn commit: r1348521 - in /hive/trunk: build.xml findbugs/ findbugs/findbugs-exclude.xml ivy.xml ivy/libraries.properties

Author: ecapriolo
Date: Sun Jun 10 01:29:34 2012
New Revision: 1348521

URL: http://svn.apache.org/viewvc?rev=1348521&view=rev
Log:
HIVE-3099. add findbugs in build.xml (Ransom Hezhiqiang via egc)


Added:
    hive/trunk/findbugs/
    hive/trunk/findbugs/findbugs-exclude.xml
Modified:
    hive/trunk/build.xml
    hive/trunk/ivy.xml
    hive/trunk/ivy/libraries.properties

Modified: hive/trunk/build.xml
URL: http://svn.apache.org/viewvc/hive/trunk/build.xml?rev=1348521&r1=1348520&r2=1348521&view=diff
==============================================================================
--- hive/trunk/build.xml (original)
+++ hive/trunk/build.xml Sun Jun 10 01:29:34 2012
@@ -907,6 +907,87 @@
     </available>
   </target>
 
+	<!-- ================================================================== -->
+	<!-- Findbugs                                                         -->
+	<!-- ================================================================== -->
+
+
+	<target name="ivy-resolve-findbugs" depends="ivy-init-settings">
+		<echo message="Project: ${ant.project.name}" />
+		<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="findbugs" log="${ivyresolvelog}" />
+	</target>
+
+	<property name="ivy.findbugs.retrieve.pattern" value="[conf]/[artifact].[ext]" />
+
+	<target name="ivy-retrieve-findbugs" depends="ivy-resolve-findbugs" description="Retrieve Ivy-managed artifacts for the checkstyle configurations">
+		<echo message="Project: ${ant.project.name}" />
+		<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.findbugs.retrieve.pattern}" log="${ivyresolvelog}" />
+	</target>
+
+	<target name="check-for-findbugs">
+		<echo message="Project: ${ant.project.name}" />
+		<path id="findbugs.classpath">
+			<fileset dir="${build.ivy.lib.dir}/findbugs">
+				<include name="*.jar" />
+			</fileset>
+		</path>
+		<pathconvert property="findbugs.classpath" refid="findbugs.classpath" />
+	</target>
+
+	<target name="findbugs" depends="init,ivy-retrieve-findbugs,check-for-findbugs" description="Run findbugs on source files">
+		<echo message="Project: ${ant.project.name}" />
+        
+        <property name="findbugs.conf.dir" location="${hive.root}/findbugs" />
+        <property name="findbugs.build.dir" location="${build.dir.hive}/findbugs" />
+        <property name="findbugs.exclude.file" value="${findbugs.conf.dir}/findbugs-exclude.xml"/>
+        <property name="findbugs.report.htmlfile" value="${findbugs.build.dir}/findbugs-report.html"/>
+        <property name="findbugs.report.xmlfile" value="${findbugs.build.dir}/findbugs-report.xml"/>
+        
+		<mkdir dir="${findbugs.build.dir}" />
+		<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${build.ivy.lib.dir}/findbugs/findbugs-ant.jar" />
+
+		<findbugs classpath="${findbugs.classpath}" pluginList="" effort="max" output="xml" outputFile="${findbugs.report.xmlfile}" excludeFilter="${findbugs.exclude.file}">
+		 
+            <auxClasspath>
+				<fileset dir="${build.dir.hive}">
+					<include name="**/*.jar" />
+				</fileset>
+			</auxClasspath>
+            
+			<sourcePath path="${hive.root}/ant" />
+			<sourcePath path="${hive.root}/builtins" />
+            <sourcePath path="${hive.root}/cli" />
+			<sourcePath path="${hive.root}/common" />
+			<sourcePath path="${hive.root}/contrib" />
+			<sourcePath path="${hive.root}/hbase-handler" />
+			<sourcePath path="${hive.root}/hwi" />
+			<sourcePath path="${hive.root}/jdbc" />
+			<sourcePath path="${hive.root}/metastore" />
+			<sourcePath path="${hive.root}/odbc" />
+			<sourcePath path="${hive.root}/pdk" />
+            <sourcePath path="${hive.root}/ql" />
+			<sourcePath path="${hive.root}/serde" />
+			<sourcePath path="${hive.root}/service" />
+			<sourcePath path="${hive.root}/shims" />
+			<class location="${build.dir.hive}/anttasks/classes" />
+            <class location="${build.dir.hive}/builtins/classes" />
+            <class location="${build.dir.hive}/cli/classes" />
+			<class location="${build.dir.hive}/common/classes" />
+			<class location="${build.dir.hive}/contrib/classes" />
+            <class location="${build.dir.hive}/hbase-handler/classes" />
+			<class location="${build.dir.hive}/hwi/classes" />
+            <class location="${build.dir.hive}/jdbc/classes" />
+			<class location="${build.dir.hive}/metastore/classes" />
+            <class location="${build.dir.hive}/pdk/classes" />
+			<class location="${build.dir.hive}/ql/classes" />
+            <class location="${build.dir.hive}/serde/classes" />
+			<class location="${build.dir.hive}/service/classes" />
+            <class location="${build.dir.hive}/shims/classes" />
+		</findbugs>
+        <!--
+        <xslt style="${findbugs.conf.dir}/default.xsl" in="${findbugs.report.xmlfile}"  out="${findbugs.report.htmlfile}"/>
+        -->
+	</target>
   <target name="ivy-docs" depends="ivy-init-settings"
     description="Resolve, Retrieve Ivy-managed artifacts for docs configuration">
     <echo message="Project: ${ant.project.name}"/>

Added: hive/trunk/findbugs/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/hive/trunk/findbugs/findbugs-exclude.xml?rev=1348521&view=auto
==============================================================================
--- hive/trunk/findbugs/findbugs-exclude.xml (added)
+++ hive/trunk/findbugs/findbugs-exclude.xml Sun Jun 10 01:29:34 2012
@@ -0,0 +1,35 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<FindBugsFilter>
+    <Match>
+       <Class name="~org.apache.hadoop.hive.metastore.parser.*" />
+    </Match>
+     <Match>
+        <Class name="org.apache.hadoop.hive.ql.parse.HiveLexer" />
+    </Match>
+     <Match>
+        <Class name="org.apache.hadoop.hive.ql.parse.HiveParser" />
+    </Match>
+    <Match>
+        <Class name="~org.apache.hadoop.hive.metastore.api.*" />
+    </Match>
+     <Match>
+        <Class name="~org.apache.hadoop.hive.ql.plan.api.*" />
+    </Match>
+    
+    
+</FindBugsFilter>

Modified: hive/trunk/ivy.xml
URL: http://svn.apache.org/viewvc/hive/trunk/ivy.xml?rev=1348521&r1=1348520&r2=1348521&view=diff
==============================================================================
--- hive/trunk/ivy.xml (original)
+++ hive/trunk/ivy.xml Sun Jun 10 01:29:34 2012
@@ -27,6 +27,7 @@
     <!-- Private configurations -->
     <conf name="docs" visibility="private"/>
     <conf name="checkstyle" visibility="private"/>
+    <conf name="findbugs" visibility="private"/>
     <conf name="rat" visibility="private"/>
     <conf name="maven" visibility="private"/>
   </configurations>
@@ -39,6 +40,8 @@
                rev="${rat.version}" conf="rat->default"/>
    <dependency org="checkstyle" name="checkstyle" rev="${checkstyle.version}"
      conf="checkstyle->default"/>
+   <dependency org="com.google.code.findbugs" name="findbugs-ant" rev="${findbugs.version}"
+     conf="findbugs->default"/>
    <dependency org="org.jdom" name="jdom" rev="${jdom.version}"
      conf="docs->default"/>
    <dependency org="org.apache.velocity" name="velocity" rev="${velocity.version}"

Modified: hive/trunk/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hive/trunk/ivy/libraries.properties?rev=1348521&r1=1348520&r2=1348521&view=diff
==============================================================================
--- hive/trunk/ivy/libraries.properties (original)
+++ hive/trunk/ivy/libraries.properties Sun Jun 10 01:29:34 2012
@@ -29,6 +29,7 @@ datanucleus-core.version=2.0.3
 datanucleus-enhancer.version=2.0.3
 datanucleus-rdbms.version=2.0.3
 checkstyle.version=5.0
+findbugs.version=1.3.9
 commons-cli.version=1.2
 commons-codec.version=1.4
 commons-collections.version=3.2.1