| <?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="hbase-storage-handler" default="jar" |
| xmlns:artifact="artifact:org.apache.maven.artifact.ant"> |
| |
| <property name="path.to.basedir" location="${basedir}/../.."/> |
| <loadproperties srcfile="${path.to.basedir}/build.properties"/> |
| |
| <!-- |
| ================================================================================ |
| Properties and Classpaths Section |
| ================================================================================ |
| --> |
| <!-- name and version --> |
| <property name="handler.version" value="0.1.0"/> |
| <property name="handler.jar" value="${ant.project.name}-${handler.version}.jar"/> |
| <property name="final.name" value="${ant.project.name}-${handler.version}" /> |
| <property name="hcatalog.dir" value="${basedir}/../.." /> |
| |
| <!-- hive properties --> |
| <property name="hive.root" value="${hcatalog.dir}/hive/external"/> |
| |
| <!-- build properties --> |
| <property name="lib.dir" value="${basedir}/lib/" /> |
| <property name="src.dir" location="${basedir}/src/java"/> |
| <property name="resources.dir" location="${basedir}/src/resources"/> |
| <property name="build.dir" value="${basedir}/build"/> |
| <property name="build.classes" value="${build.dir}/classes" /> |
| <property name="dist.dir" value="${build.dir}/${final.name}" /> |
| |
| <!-- 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.tmp.dir" value="${test.build.dir}/temp" /> |
| <property name="test.data.dir" value="${test.build.dir}/data" /> |
| <property name="test.timeout" value="2700000" /> |
| <property name="test.junit.output.format" value="plain" /> |
| <property name="test.output" value="no"/> |
| <property name="hive.conf.dir" value="${hive.root}/conf"/> |
| |
| <path id="compile.class.path"> |
| <fileset dir="${build.dir}/lib/compile"/> |
| </path> |
| |
| <path id="test.class.path"> |
| <fileset dir="${build.dir}/lib/test"/> |
| <pathelement location="${test.build.classes}" /> |
| <pathelement location="${build.classes}" /> |
| <pathelement location="conf"/> |
| </path> |
| |
| <target name="init" depends="mvn-dependencies"> |
| <mkdir dir="${dist.dir}" /> |
| <mkdir dir="${build.classes}" /> |
| <mkdir dir="${test.build.classes}" /> |
| </target> |
| <!-- |
| ================================================================================ |
| Main Build and Jar Section |
| ================================================================================ |
| --> |
| <!-- Compile src files --> |
| <target name="compile-src" depends="init"> |
| <javac encoding="${build.encoding}" srcdir="${src.dir}:${basedir}/src/gen-java:${basedir}/src/resources" 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"> |
| <copy todir="${build.classes}" includeEmptyDirs="false"> |
| <fileset dir="${resources.dir}"> |
| <include name="*"/> |
| </fileset> |
| </copy> |
| <jar jarfile="${build.dir}/${handler.jar}" basedir="${build.classes}"/> |
| </target> |
| |
| <!-- |
| ================================================================================ |
| Test Section |
| ================================================================================ |
| --> |
| <!-- Build test files --> |
| <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> |
| |
| <!-- Run the unit tests --> |
| <target name="test" depends="compile-test"> |
| <sequential> |
| <delete dir="${test.log.dir}"/> |
| <delete dir="${test.tmp.dir}" /> |
| <delete dir="${test.data.dir}" /> |
| <mkdir dir="${test.log.dir}"/> |
| <mkdir dir="${test.tmp.dir}" /> |
| <mkdir dir="${test.data.dir}" /> |
| <junit showoutput="${test.output}" printsummary="yes" haltonfailure="no" |
| fork="yes" maxmemory="512m" dir="${basedir}" timeout="${test.timeout}" |
| errorProperty="tests.failed" failureProperty="tests.failed"> |
| <classpath> |
| <pathelement location="${test.build.classes}" /> |
| <pathelement location="." /> |
| <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" includes="**/Test*.java"/> |
| <fileset dir="src/test" includes="**/lock/*Test.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" includes="**/${testcase}.java"/> |
| </batchtest> |
| <assertions> |
| <enable /> |
| </assertions> |
| </junit> |
| <fail if="tests.failed">Tests failed!</fail> |
| </sequential> |
| </target> |
| |
| <!-- |
| ================================================================================ |
| Clean Section |
| ================================================================================ |
| --> |
| |
| <!-- Clean up --> |
| <target name="clean" description="Cleanup build artifacts"> |
| <delete dir="${build.dir}" /> |
| </target> |
| |
| <!-- |
| =============================================================================== |
| Distribution Section |
| =============================================================================== |
| --> |
| <target name="package" depends="jar" description="Create an HCatalog release"> |
| <mkdir dir="${dist.dir}" /> |
| <mkdir dir="${dist.dir}/conf" /> |
| <mkdir dir="${dist.dir}/lib" /> |
| |
| <copy todir="${dist.dir}/lib" includeEmptyDirs="false"> |
| <fileset dir="${build.dir}"> |
| <include name="hbase-storage-handler-*.jar"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/conf"> |
| <fileset dir="${basedir}/conf" /> |
| </copy> |
| |
| <antcall target="package-to-handlers"/> |
| </target> |
| |
| <target name="package-to-handlers" if="dist.handlers.dir"> |
| <mkdir dir="${dist.handlers.dir}/hbase"/> |
| <copy todir="${dist.handlers.dir}/hbase" includeEmptyDirs="true"> |
| <fileset dir="${dist.dir}"> |
| <include name="**/lib/hbase-storage-handler-*.jar"/> |
| <include name="**/conf/**/*"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <import file="${path.to.basedir}/build-support/ant/deploy.xml"/> |
| |
| </project> |