blob: 0e9461150bdbd96afda966ae916c9f9504b27471 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
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="metastore" default="jar">
<property name="src.dir" value="${basedir}/src"/>
<import file="../build-common.xml"/>
<property name="model.dir" value="${src.dir}/model"/>
<uptodate property="grammarBuild.notRequired">
<srcfiles dir= "${src.dir}/java/org/apache/hadoop/hive/metastore/parser" includes="**/*.g"/>
<mapper type="merge" to="${build.dir}/gen/antlr/gen-java/org/apache/hadoop/hive/metastore/parser/FilterParser.java"/>
</uptodate>
<target name="build-grammar" unless="grammarBuild.notRequired" depends="ivy-retrieve">
<echo message="Project: ${ant.project.name}"/>
<echo>Building Grammar ${src.dir}/java/org/apache/hadoop/hive/metastore/parser/Filter.g ....</echo>
<java classname="org.antlr.Tool" classpathref="classpath" fork="false" failonerror="true">
<arg value="-fo" />
<arg value="${build.dir}/gen/antlr/gen-java/org/apache/hadoop/hive/metastore/parser" />
<arg value="${src.dir}/java/org/apache/hadoop/hive/metastore/parser/Filter.g" />
</java>
</target>
<target name="metastore-init">
<echo message="Project: ${ant.project.name}"/>
<mkdir dir="${build.dir}/gen/antlr/gen-java/org/apache/hadoop/hive/metastore/parser"/>
</target>
<target name="core-compile" depends="init,metastore-init,build-grammar,model-compile,ivy-retrieve">
<echo message="Project: ${ant.project.name}"/>
<javac
encoding="${build.encoding}"
srcdir="${src.dir}/java:${src.dir}/gen/thrift/gen-javabean:${build.dir}/gen/antlr/gen-java"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
includeantruntime="false">
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile" depends="core-compile, model-compile, model-enhance">
<echo message="Project: ${ant.project.name}"/>
</target>
<target name="model-compile" depends="init">
<echo message="Project: ${ant.project.name}"/>
<javac
srcdir="${model.dir}"
destdir="${build.classes}"
debug="${javac.debug}"
includeantruntime="false">
<classpath refid="classpath"/>
</javac>
<!-- ORM data for model -->
<copy file="${model.dir}/package.jdo" todir="${build.classes}"/>
</target>
<uptodate property="enhanceModel.notRequired">
<srcfiles dir= "${model.dir}" includes="**/*.java,*.jdo"/>
<mapper type="merge" to="${build.dir}/hive-${ant.project.name}-${version}.jar"/>
</uptodate>
<target name="model-enhance" depends="model-compile" unless="enhanceModel.notRequired" >
<echo message="Project: ${ant.project.name}"/>
<taskdef name="datanucleusenhancer"
classname="org.datanucleus.enhancer.tools.EnhancerTask">
<classpath refid="classpath"/>
</taskdef>
<datanucleusenhancer
dir="${base.dir}" failonerror="true" verbose="true" fork="true">
<fileset dir="${model.dir}">
<include name="**/*.jdo"/>
</fileset>
<classpath>
<path refid="classpath"/>
<pathelement path="${build.dir}/classes/"/>
</classpath>
<jvmarg line="${jvm.args} -Dlog4j.configuration=${basedir}/../conf/hive-log4j.properties"/>
</datanucleusenhancer>
</target>
<target name="model-jar" depends="model-enhance">
<echo message="Project: ${ant.project.name}"/>
<jar
jarfile="${build.dir}/${name}-model-${version}.jar"
basedir="${build.classes}"
includes="**/model/M*">
<manifest>
<!-- Not putting these in their own manifest section, since that inserts
a new-line, which breaks the reading of the attributes. -->
<attribute name="Implementation-Title" value="Hive"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache"/>
</manifest>
<metainf dir="${hive.root}" includes="LICENSE,NOTICE"/>
</jar>
</target>
<target name="generate-schema">
<echo message="Project: ${ant.project.name}"/>
<java classname="org.jpox.SchemaTool" failonerror="true" dir="${basedir}" fork="true">
<classpath>
<path refid="classpath"/>
<pathelement path="${build.dir}/classes/"/>
</classpath>
<sysproperty key="log4j.configuration" value="file:${basedir}/../../../../conf/log4j.properties"/>
<arg line="-props jdo/jpox.properties -create jdo/package.jdo" />
</java>
</target>
</project>