blob: bef436fc37359543a521826f3cdb1c1534e82c69 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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="webhcat-java-client" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="hcatalog.version" value="0.4.1"/>
<property name="path.to.basedir" location="${basedir}/../.."/>
<property name="lib.dir" value="${basedir}/lib/" />
<property name="src.dir" location="${basedir}/src/main/java"/>
<property name="docs.src" value="${basedir}/src/docs"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.docs" value="${build.dir}/docs" />
<property name="build.javadoc" value="${build.docs}/api" />
<property name="dist.dir" value="${build.dir}/${ant.project.name}" />
<property name="jar.name" value="${ant.project.name}.jar" />
<!-- javac properties -->
<property name="build.encoding" value="UTF8" />
<property name="excludes" value=""/>
<property name="javac.debug" value="on" />
<property name="javac.optimize" value="on" />
<property name="javac.deprecation" value="off" />
<property name="javac.version" value="1.6" />
<property name="javac.args" value="" />
<!-- test properties -->
<property name="test.src.dir" value="${basedir}/src/test" />
<property name="test.build.dir" value="${build.dir}/test" />
<property name="test.build.classes" value="${test.build.dir}/classes" />
<property name="test.log.dir" value="${test.build.dir}/logs" />
<property name="test.timeout" value="2700000" />
<property name="test.junit.output.format" value="plain" />
<property name="test.output" value="no"/>
<property name="test.warehouse.dir" value="/tmp/hcat_junit_warehouse"/>
<property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
<property name="ivy.repo.dir" value="${user.home}/ivyrepo" />
<property name="ivy.dir" location="${path.to.basedir}/ivy" />
<loadproperties srcfile="${path.to.basedir}/ivy/libraries.properties"/>
<property name="asfrepo" value="https://repository.apache.org"/>
<property name="asfsnapshotrepo" value="${asfrepo}/content/repositories/snapshots"/>
<property name="mvnrepo" value="http://repo2.maven.org/maven2"/>
<property name="asfstagingrepo" value="${asfrepo}/service/local/staging/deploy/maven2"/>
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
<property name="ant_task.jar" location="${ivy.dir}/maven-ant-tasks-${ant-task.version}.jar"/>
<property name="ant_task_repo_url"
value="${mvnrepo}/org/apache/maven/maven-ant-tasks/${ant-task.version}/maven-ant-tasks-${ant-task.version}.jar"/>
<property name="ivy_repo_url" value="${mvnrepo}/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}"/>
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<!-- rats properties -->
<property name="rat.reporting.classname" value="rat.Report"/>
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[artifact]-[revision](-[classifier]).[ext]"/>
<import file="../../build-common.xml"/>
<target name="init" depends="ivy-compile" >
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${test.build.classes}" />
</target>
<!--
================================================================================
Main Build and Jar Section
================================================================================
-->
<!-- Compile src files -->
<path id="compile.class.path">
<fileset dir="${build.dir}/ivy/lib/webhcat-java-client" includes="**/*.jar"/>
<dirset dir="../../build/classes"/>
</path>
<target name="compile-src" depends="init">
<javac encoding="${build.encoding}" srcdir="${src.dir}:${basedir}/src/main/java" excludes="${excludes}"
includes="**/*.java" destdir="${build.classes}" debug="${javac.debug}"
optimize="${javac.optimize}" target="${javac.version}"
source="${javac.version}" deprecation="${javac.deprecation}"
includeantruntime="false">
<compilerarg line="${javac.args}"/>
<classpath refid="compile.class.path" />
</javac>
</target>
<!-- Build the jar -->
<target name="jar" depends="compile-src">
<echo message="${ant.project.name}"/>
<jar jarfile="${build.dir}/${jar.name}" basedir="${build.classes}"/>
</target>
<!--
================================================================================
Test Section
================================================================================
-->
<!-- Build test files -->
<path id="test.class.path">
<fileset dir="${build.dir}/ivy/lib" includes="**/*.jar"/>
<fileset dir="../../build/ivy/lib/hcatalog/" includes="**/*.jar"/>
<dirset dir="${path.to.basedir}/build/test/classes"/>
<dirset dir="${basedir}/build/classes"/>
<dirset dir="${basedir}/build/test/classes"/>
<dirset dir="${path.to.basedir}/build/classes"/>
</path>
<target name="compile-test" depends="jar">
<javac encoding="${build.encoding}" srcdir="${test.src.dir}" excludes="${excludes}"
includes="**/*.java" destdir="${test.build.classes}" debug="${javac.debug}"
optimize="${javac.optimize}" target="${javac.version}"
source="${javac.version}" deprecation="${javac.deprecation}"
includeantruntime="false">
<compilerarg line="${javac.args}"/>
<classpath refid="test.class.path" />
</javac>
</target>
<path id="findbugs.class.path">
<fileset dir="${build.dir}/ivy/lib/default" includes="*.jar"/>
</path>
<target name="clean">
<echo message="${ant.project.name}"/>
<delete dir="${build.dir}"/>
<delete dir="${test.warehouse.dir}"/>
</target>
<!-- Run the unit tests -->
<target name="test" depends="compile-test">
<delete dir="${test.warehouse.dir}"/>
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.warehouse.dir}"/>
<mkdir dir="${test.log.dir}"/>
<sequential>
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.log.dir}"/>
<junit showoutput="${test.output}" printsummary="yes" haltonfailure="no"
fork="yes" maxmemory="512m" dir="${basedir}" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="hive.metastore.warehouse.dir" value="${test.warehouse.dir}"/>
<classpath>
<!-- <pathelement location="${test.build.classes}" />
<pathelement location="." /> i-->
<path refid="test.class.path"/>
<pathelement path="${clover.jar}"/>
</classpath>
<formatter type="${test.junit.output.format}" />
<!-- If the user has not defined a particular test to run, run them all -->
<batchtest fork="yes" todir="${test.log.dir}" unless="testcase">
<fileset dir="src/test/java" includes="**/*.java"/>
</batchtest>
<!-- Run one test case. To use this define -Dtestcase=X on the command line -->
<batchtest fork="yes" todir="${test.log.dir}" if="testcase">
<fileset dir="src/test/java" includes="**/*${testcase}.java"/>
</batchtest>
<assertions>
<enable />
</assertions>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</sequential>
</target>
<!--
================================================================================
Ivy Section
================================================================================
-->
<!-- Ivy goop stolen directly from Pig's build.xml -->
<target name="ivy-init-dirs">
<mkdir dir="${build.ivy.dir}" />
<mkdir dir="${build.ivy.lib.dir}" />
<mkdir dir="${build.ivy.report.dir}" />
</target>
<target name="ivy-probe-antlib">
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>
<target name="ivy-download" description="To download ivy" unless="offline">
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<!--
To avoid Ivy leaking things across big projects, always load Ivy in the same classloader.
Also note how we skip loading Ivy if it is already there, just to make sure all is well.
-->
<target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}"/>
</classpath>
</typedef>
<fail>
<condition >
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="ivy-init" depends="ivy-init-antlib" >
<!--Configure Ivy by reading in the settings file
If anyone has already read in a settings file into this settings ID, it gets priority
-->
<ivy:configure settingsid="${ant.project.name}.ivy.settings"
file="${ivysettings.xml}" override='false'/>
</target>
<target name="ivy-compile" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for compile configuration">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common"/>
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="common"/>
<ivy:cachepath pathid="compile.classpath" conf="common"/>
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="default"/>
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
conf="default"/>
<ivy:cachepath pathid="compile.classpath" conf="default"/>
</target>
<target name="ivy-releaseaudit" depends="ivy-init" description="Resolve, Retrieve Ivy-managed artifacts for releaseaudit configuration">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="releaseaudit"/>
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" conf="releaseaudit"/>
<ivy:cachepath pathid="releaseaudit.classpath" conf="releaseaudit"/>
</target>
<!--
===============================================================================
Distribution Section
===============================================================================
-->
<target name="package" depends="jar, docs" description="Create an HCatalog release">
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.dir}/lib" />
<mkdir dir="${dist.dir}/docs" />
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="${lib.dir}" erroronmissingdir="false" />
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}" />
</copy>
</target>
<!--
================================================================================
Docs Section
================================================================================
-->
<target name="docs" depends="javadoc">
</target>
<target name="javadoc" depends="jar" description="Create documentation">
<mkdir dir="${build.javadoc}" />
<javadoc packagenames="org.apache.hcatalog.*" destdir="${build.javadoc}" author="true" version="true" use="true"
windowtitle="HCatalog ${hcatalog.version} API" doctitle="HCatalog ${hcatalog.version} API" sourcepath="${src.dir}">
<!--<packageset dir="${src.dir}" /> -->
<classpath>
<path refid="compile.class.path" />
</classpath>
<group title="hcatalog" packages="org.apache.hcatalog.*" />
</javadoc>
</target>
</project>