blob: 624f2ccb687e8d04a24d7a5a36a68c23af7bcad7 [file] [log] [blame]
<?xml version="1.0"?>
<!--
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.
-->
<project name="hcatalog" default="jar"
xmlns:artifact="artifact:org.apache.maven.artifact.ant">
<property name="path.to.basedir" location="${basedir}"/>
<loadproperties srcfile="${basedir}/build.properties"/>
<!--
================================================================================
Properties and Classpaths Section
================================================================================
-->
<condition property="staging">
<equals arg1="${repo}" arg2="staging"/>
</condition>
<!-- e2e test properties -->
<property name="test.e2e.dir" value="${basedir}/src/test/e2e/hcatalog"/>
<!-- packaging properties -->
<property name="package.prefix" value="/usr"/>
<property name="package.conf.dir" value="/etc/hcatalog"/>
<property name="package.log.dir" value="/var/log/hcatalog"/>
<property name="package.pid.dir" value="/var/run/hcatalog"/>
<property name="package.var.dir" value="/var/lib/hcatalog"/>
<property name="package.share.dir" value="/share/hcatalog/${module}"/>
<property name="package.buildroot" value="${build.dir}/rpm/hcatalog_package_build_${user.name}"/>
<property name="package.build.dir" value="${build.dir}/rpm/hcatalog_package_build_${user.name}/BUILD"/>
<!-- rats properties -->
<property name="rat.reporting.classname" value="rat.Report"/>
<target name="init">
<mkdir dir="${dist.dir}"/>
</target>
<!--
================================================================================
Build all jars
================================================================================
-->
<target name="jar" depends="init" description="build all jars">
<ant target="jar" dir="core" inheritAll="false">
<property name="_mvn.hadoop.profile" value="${mvn.hadoop.profile}"/>
</ant>
<ant target="jar" dir="hcatalog-pig-adapter" inheritAll="false">
<property name="_mvn.hadoop.profile" value="${mvn.hadoop.profile}"/>
</ant>
<ant target="jar" dir="server-extensions" inheritAll="false">
<property name="_mvn.hadoop.profile" value="${mvn.hadoop.profile}"/>
</ant>
<ant target="jar" dir="webhcat/svr" inheritAll="false">
<property name="_mvn.hadoop.profile" value="hadoop20"/>
</ant>
<ant target="jar" dir="webhcat/java-client" inheritAll="false">
<property name="_mvn.hadoop.profile" value="${mvn.hadoop.profile}"/>
</ant>
<ant target="jar" dir="storage-handlers/hbase" inheritAll="false">
<property name="_mvn.hadoop.profile" value="hadoop20"/>
</ant>
</target>
<!--
================================================================================
Test Section
================================================================================
-->
<target name="test" depends="jar" description="run unit tests">
<ant target="test" dir="core" inheritAll="false"/>
<ant target="test" dir="hcatalog-pig-adapter" inheritAll="false"/>
<ant target="test" dir="server-extensions" inheritAll="false"/>
<ant target="test" dir="webhcat/svr" inheritAll="false"/>
<ant target="test" dir="webhcat/java-client" inheritAll="false"/>
<ant target="test" dir="storage-handlers/hbase" inheritAll="false"/>
</target>
<target name="test-with-clover" depends="clover-init"
description="run unit tests and generate code coverage reports">
<ant target="_test-with-clover" dir="core" inheritAll="false"/>
<ant target="_test-with-clover" dir="hcatalog-pig-adapter" inheritAll="false"/>
<ant target="_test-with-clover" dir="server-extensions" inheritAll="false"/>
<ant target="_test-with-clover" dir="webhcat/svr" inheritAll="false"/>
<ant target="_test-with-clover" dir="webhcat/java-client" inheritAll="false"/>
<!-- storage-handlers do not have coverage as they have not
yet been migrated to the new build files. -->
<ant target="test" dir="storage-handlers/hbase" inheritAll="false"/>
</target>
<!--
================================================================================
Findbugs Section
================================================================================
-->
<target name="findbugs" depends="init-findbugs,jar">
<property name="findbugs.out.dir" value="${test.dir}/findbugs"/>
<property name="findbugs.exclude.file" value="${test.src.dir}/findbugsExcludeFile.xml"/>
<property name="findbugs.report.htmlfile"
value="${findbugs.out.dir}/hcat-findbugs-report.html"/>
<property name="findbugs.report.xmlfile"
value="${findbugs.out.dir}/hcat-findbugs-report.xml"/>
<ant target="findbugs" dir="core" inheritAll="false"/>
<ant target="findbugs" dir="hcatalog-pig-adapter" inheritAll="false"/>
<ant target="findbugs" dir="server-extensions" inheritAll="false"/>
<ant target="findbugs" dir="webhcat/svr" inheritAll="false"/>
<ant target="findbugs" dir="webhcat/java-client" inheritAll="false"/>
</target>
<!--
================================================================================
Clean Section
================================================================================
-->
<!-- Clean up children -->
<target name="clean" description="Cleanup all build artifacts">
<echo message="${ant.project.name}"/>
<delete dir="${build.dir}"/>
<ant target="clean" dir="core" inheritAll="false"/>
<ant target="clean" dir="hcatalog-pig-adapter" inheritAll="false"/>
<ant target="clean" dir="server-extensions" inheritAll="false"/>
<ant target="clean" dir="webhcat/svr" inheritAll="false"/>
<ant target="clean" dir="webhcat/java-client" inheritAll="false"/>
<ant target="clean" dir="storage-handlers/hbase" inheritAll="false"/>
<ant target="clean" dir="shims" inheritAll="false"/>
</target>
<!--
================================================================================
Docs Section
================================================================================
-->
<target name="docs" depends="forrest, javadoc"
description="Generate Javadoc and Forrest documentation">
</target>
<target name="forrest" if="forrest.home"
description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line.">
<exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
failonerror="true">
</exec>
<copy todir="${build.docs}/">
<fileset dir="${docs.src}/build/site/"/>
</copy>
</target>
<target name="javadoc" depends="jar" description="Generate Javadoc documentation">
<mkdir dir="${build.javadoc}"/>
<javadoc overview="${src.dir}/../docs/overview.html"
packagenames="org.apache.hcatalog.*"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
noqualifier="all"
windowtitle="HCatalog ${hcatalog.version} API"
doctitle="HCatalog ${hcatalog.version} API"
failonerror="true">
<packageset dir="core/src/main/java"/>
<packageset dir="hcatalog-pig-adapter/src/main/java"/>
<packageset dir="server-extensions/src/main/java"/>
<packageset dir="storage-handlers/hbase/src/gen-java"/>
<packageset dir="storage-handlers/hbase/src/java"/>
<packageset dir="webhcat/svr/src/main/java"/>
<packageset dir="webhcat/java-client/src/main/java"/>
<classpath>
<fileset dir="core/build/lib/compile"/>
<fileset dir="hcatalog-pig-adapter/build/lib/compile"/>
<fileset dir="server-extensions/build/lib/compile"/>
<fileset dir="storage-handlers/hbase/build/lib/compile"/>
<fileset dir="webhcat/svr/build/lib/compile"/>
</classpath>
<group title="hcatalog" packages="org.apache.hcatalog.*"/>
</javadoc>
</target>
<!--
===============================================================================
Deploy Section
===============================================================================
-->
<target name="mvn-deploy" depends="mvn-init"
description="Deploy artifacts to a Maven repository.">
<artifact:deploy file="pom.xml">
<artifact:pom file="pom.xml"/>
<remoteRepository id="${mvn.deploy.repo.id}" url="${mvn.deploy.repo.url}"/>
</artifact:deploy>
<ant target="mvn-deploy" dir="core" inheritAll="false" useNativeBasedir="true"/>
<ant target="mvn-deploy" dir="hcatalog-pig-adapter" inheritAll="false" useNativeBasedir="true"/>
<ant target="mvn-deploy" dir="server-extensions" inheritAll="false" useNativeBasedir="true"/>
<ant target="mvn-deploy" dir="webhcat/java-client" inheritAll="false" useNativeBasedir="true"/>
<ant target="mvn-deploy" dir="webhcat/svr" inheritAll="false" useNativeBasedir="true"/>
</target>
<target name="mvn-deploy-signed" depends="mvn-init"
description="Sign and deploy artifacts to a Maven repository.">
<input message="Enter your gpg password (or just press return if using an agent): "
addproperty="gpg.passphrase">
<handler classname="org.apache.tools.ant.input.SecureInputHandler"/>
</input>
<_sign inputFile="pom.xml"/>
<artifact:deploy file="pom.xml">
<artifact:pom file="pom.xml"/>
<attach file="pom.xml.asc" type="pom.asc"/>
<remoteRepository id="${mvn.deploy.repo.id}" url="${mvn.deploy.repo.url}"/>
</artifact:deploy>
<ant target="mvn-deploy-signed" dir="core" inheritAll="false" useNativeBasedir="true">
<property name="gpg.passphrase" value="${gpg.passphrase}"/>
</ant>
<ant target="mvn-deploy-signed" dir="hcatalog-pig-adapter" inheritAll="false" useNativeBasedir="true">
<property name="gpg.passphrase" value="${gpg.passphrase}"/>
</ant>
<ant target="mvn-deploy-signed" dir="server-extensions" inheritAll="false" useNativeBasedir="true">
<property name="gpg.passphrase" value="${gpg.passphrase}"/>
</ant>
<ant target="mvn-deploy-signed" dir="webhcat/java-client" inheritAll="false" useNativeBasedir="true">
<property name="gpg.passphrase" value="${gpg.passphrase}"/>
</ant>
<ant target="mvn-deploy-signed" dir="webhcat/svr" inheritAll="false" useNativeBasedir="true">
<property name="gpg.passphrase" value="${gpg.passphrase}"/>
</ant>
</target>
<!--
===============================================================================
Distribution Section
===============================================================================
-->
<target name="package" depends="jar, docs" description="Create an HCatalog release">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/share/${ant.project.name}/lib"/>
<mkdir dir="${dist.dir}/etc/hcatalog"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/sbin"/>
<mkdir dir="${dist.dir}/share/${ant.project.name}/scripts"/>
<mkdir dir="${dist.dir}/share/${ant.project.name}/templates/conf"/>
<mkdir dir="${dist.dir}/share/doc/${ant.project.name}"/>
<mkdir dir="${dist.dir}/share/doc/${ant.project.name}/api"/>
<mkdir dir="${dist.dir}/share/doc/${ant.project.name}/jdiff"/>
<mkdir dir="${dist.dir}/share/doc/${ant.project.name}/license"/>
<copy todir="${dist.dir}/share/${ant.project.name}" includeEmptyDirs="false">
<fileset dir="core/build">
<include name="hcatalog-*.jar"/>
</fileset>
<fileset dir="hcatalog-pig-adapter/build">
<include name="hcatalog-*.jar"/>
</fileset>
<fileset dir="server-extensions/build">
<include name="hcatalog-*.jar"/>
</fileset>
<fileset dir="webhcat/svr/build">
<include name="webhcat-*.jar"/>
</fileset>
<fileset dir="webhcat/java-client/build">
<include name="webhcat-java-client*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}/bin">
<fileset dir="bin/">
<include name="hcat"/>
</fileset>
</copy>
<copy todir="${dist.dir}/libexec">
<fileset dir="bin">
<include name="hcat-config.sh"/>
</fileset>
</copy>
<copy todir="${dist.dir}/sbin">
<fileset dir="${package.dir}">
<include name="*.sh"/>
</fileset>
</copy>
<copy todir="${dist.dir}/etc/${ant.project.name}">
<fileset dir="conf"/>
</copy>
<copy todir="${dist.dir}/share/${ant.project.name}/scripts">
<fileset dir="scripts">
<include name="*.sh"/>
</fileset>
</copy>
<copy todir="${dist.dir}/share/${ant.project.name}/templates/conf">
<fileset dir="src/packages/templates/conf">
<include name="*"/>
</fileset>
</copy>
<copy todir="${dist.dir}/sbin">
<fileset dir="${package.dir}">
<include name="*.sh"/>
</fileset>
<fileset dir="webhcat/svr/src/main/bin">
<include name="*.sh"/>
</fileset>
<fileset dir="bin">
<include name="hcat_server.sh"/>
</fileset>
</copy>
<!-- Copy the licenses and such -->
<copy todir="${dist.dir}/share/doc/${ant.project.name}">
<fileset dir=".">
<include name="*.txt"/>
</fileset>
</copy>
<copy todir="${dist.dir}/share/doc/${ant.project.name}/license">
<fileset dir="license"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${dist.dir}/bin"/>
<fileset dir="${dist.dir}/sbin"/>
</chmod>
<!--package storage-handlers -->
<property name="handlers.dir" value="${dist.dir}/share/hcatalog/storage-handlers"/>
<mkdir dir="${handlers.dir}"/>
<ant target="package" dir="storage-handlers/hbase" inheritAll="false">
<property name="dist.handlers.dir" value="${handlers.dir}"/>
</ant>
</target>
<target name="releaseaudit" description="Release Audit activities">
<java classname="${rat.reporting.classname}" fork="true">
<classpath refid="releaseaudit.classpath"/>
<arg value="${basedir}/src"/>
</java>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="src-release" depends="clean" description="Source distribution">
<mkdir dir="${build.dir}"/>
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${ant.project.name}-src-${hcatalog.version}.tar.gz">
<tarfileset dir="${basedir}" mode="644" prefix="${ant.project.name}-src-${hcatalog.version}">
<include name="conf/**"/>
<include name="core/**"/>
<include name="hcatalog-pig-adapter/**"/>
<include name="server-extensions/**"/>
<include name="webhcat/**"/>
<include name="license/**"/>
<include name="shims/**"/>
<include name="src/**"/>
<include name="storage-handlers/**"/>
<include name="*.txt"/>
<include name="*.xml"/>
<include name="KEYS"/>
</tarfileset>
<tarfileset dir="" mode="755" prefix="${ant.project.name}-src-${hcatalog.version}">
<include name="scripts/**"/>
<include name="bin/**"/>
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Make release binary packages -->
<!-- ================================================================== -->
<target name="tar" depends="package" description="Create release tarball">
<tar compression="gzip" longfile="gnu" destfile="${build.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}" mode="664">
<include name="${final.name}/**"/>
<exclude name="${final.name}/bin/*"/>
<exclude name="${final.name}/sbin/*"/>
<exclude name="${final.name}/share/hcatalog/scripts/*"/>
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*"/>
<include name="${final.name}/sbin/*"/>
<include name="${final.name}/share/hcatalog/scripts/*"/>
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- End to end tests -->
<!-- ================================================================== -->
<target name="test-e2e" description="run end-to-end tests">
<ant dir="${test.e2e.dir}"/>
</target>
<target name="test-e2e-install" description="deploy end-to-end tests to existing cluster">
<ant dir="${test.e2e.dir}" target="install"/>
</target>
<target name="test-e2e-deploy" description="deploy end-to-end tests to existing cluster">
<ant dir="${test.e2e.dir}" target="deploy"/>
</target>
<import file="ant/deploy.xml"/>
<import file="ant/findbugs.xml"/>
<import file="ant/test.xml"/>
</project>