Skip to content
Browse files

HIVE-3099. add findbugs in build.xml (Ransom Hezhiqiang via egc)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1348521 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 7212d3e commit 630eefc987bde17b05f5c0fadab8e157c819dd75 Edward Capriolo committed Jun 10, 2012
Showing with 120 additions and 0 deletions.
  1. +81 −0 build.xml
  2. +35 −0 findbugs/findbugs-exclude.xml
  3. +3 −0 ivy.xml
  4. +1 −0 ivy/libraries.properties
View
81 build.xml
@@ -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}"/>
View
35 findbugs/findbugs-exclude.xml
@@ -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>
View
3 ivy.xml
@@ -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}"
View
1 ivy/libraries.properties
@@ -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

0 comments on commit 630eefc

Please sign in to comment.
Something went wrong with that request. Please try again.