blob: bc1a2feb13cdb780004c9655a49db10e1d8e7e7c [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="gora" default="publish-local-all"
xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="year" value="2011" />
<property name="project.dir" value="${basedir}"/>
<property name="version" value="0.2-incubating" />
<property name="final.name" value="${ant.project.name}-${version}" />
<property name="dist.base.dir" value="${basedir}/dist"/>
<property name="dist.dir" value="${dist.base.dir}/${final.name}"/>
<property name="build.dir" value="${basedir}/build" />
<property name="docs.dir" value="${basedir}/docs" />
<property name="build.docs" value="${build.dir}/docs" />
<property name="build.javadoc" value="${build.docs}/api/" />
<property name="javadoc.link.java" value="http://java.sun.com/javase/6/docs/api/" />
<property name="javadoc.link.hadoop" value="http://hadoop.apache.org/common/docs/r0.20.2/api/" />
<property name="javadoc.link.avro" value="http://avro.apache.org/docs/1.3.3/api/java/" />
<property name="build.javadoc.timestamp" value="${build.javadoc}/index.html" />
<!-- module directories -->
<property name="src.dir" value="src/main/java" />
<property name="conf.dir" value="conf" />
<property name="lib.dir" value="lib" />
<property name="lib-ext.dir" value="lib-ext" />
<property name="build.classes.dir" value="build/classes" />
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- setup ivy default configuration with some custom info -->
<property name="ivy.file" value="ivy.xml" />
<property name="ivy.version" value="2.1.0" />
<property name="ivy.dir" value="${basedir}/ivy" />
<property name="project.ivy.dir" value="${project.dir}/ivy" />
<property name="ivy.jar" location="${project.ivy.dir}/ivy-${ivy.version}.jar" />
<property name="ivy.repo.url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local" />
<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.shared.default.root" value="${ivy.default.ivy.user.dir}/shared" />
<property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<!-- target: init ================================================ -->
<target name="init" depends="ivy-init">
<chmod dir="bin" perm="ugo+rx" includes="*.sh, gora"/>
</target>
<!-- target: -buildlist ================================================ -->
<target name="-buildlist" depends="init">
<ivy:buildlist reference="build-path" ivyfilepath="ivy/${ivy.file}">
<fileset dir="." includes="*/build.xml" excludes="build.xml"/>
</ivy:buildlist>
</target>
<target name="compile" depends="-buildlist">
<subant target="compile" buildpathref="build-path" />
</target>
<target name="jar" depends="-buildlist">
<subant target="jar" buildpathref="build-path" />
</target>
<target name="jar-snapshot" depends="-buildlist, jar" description="copies the jar files to append timestamp to artifact name">
<subant target="jar-snapshot" buildpathref="build-path" />
</target>
<target name="compile-test" depends="publish-local-all-test">
</target>
<target name="test-jar" depends="publish-local-all-test"/>
<target name="test-jar-snapshot" depends="test-jar" description="copies the jar files to append timestamp to artifact name">
<subant target="test-jar-snapshot" buildpathref="build-path" />
</target>
<target name="test" depends="publish-local-all-test">
<subant target="test" buildpathref="build-path" />
</target>
<target name="nightly" depends="test, tar" />
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<path id="classpath">
<dirset dir=".">
<include name="*/${build.classes.dir}"/>
<include name="*/${conf.dir}"/>
</dirset>
<fileset dir=".">
<include name="**/*.jar" />
</fileset>
</path>
<target name="javadoc-uptodate" depends="compile">
<uptodate property="javadoc.is.uptodate">
<srcfiles dir="${project.dir}/gora-core/${src.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<mapper type="merge" to="${build.javadoc.timestamp}" />
</uptodate>
</target>
<target name="javadoc" description="Generate javadoc" depends="javadoc-uptodate"
unless="javadoc.is.uptodate">
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="gora-core/${src.dir}/overview.html"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="Apache Gora API"
doctitle="Apache Gora API"
bottom="Copyright &amp;copy; ${year} The Apache Software Foundation">
<packageset dir="gora-core/src/main/java"/>
<packageset dir="gora-cassandra/src/main/java"/>
<packageset dir="gora-hbase/src/main/java"/>
<packageset dir="gora-sql/src/main/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.avro}"/>
<link href="${javadoc.link.hadoop}"/>
<classpath refid="classpath"/>
<group title="Core" packages="org.apache.gora.*"/>
<group title="Cassandra Module" packages="org.apache.gora.cassandra.*"/>
<group title="HBase Module" packages="org.apache.gora.hbase.*"/>
<group title="Sql Module" packages="org.apache.gora.sql.*"/>
</javadoc>
</target>
<target name="docs" depends="forrest.check, javadoc" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
<exec dir="${docs.dir}" executable="${forrest.home}/bin/forrest" failonerror="true">
<arg value="-Dforrest.validate.xdocs.failonerror=false"/>
<arg value="-Dproject.build-dir=${build.docs}"/>
</exec>
<copy todir="${build.docs}/site/api/" includeEmptyDirs="false">
<fileset dir="${build.javadoc}"/>
</copy>
</target>
<target name="forrest.check" unless="forrest.home">
<fail message="'forrest.home' is not defined. Please pass -Dforrest.home=&lt;base of Apache Forrest installation&gt; to Ant on the command-line." />
</target>
<!-- ================================================================== -->
<!-- Distribution -->
<!-- ================================================================== -->
<target name="package" depends="-buildlist, test-jar"
description="Build distribution">
<subant target="package" buildpathref="build-path" />
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<copy todir="${dist.dir}/ivy">
<fileset dir="ivy">
<exclude name="ivy*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
<include name="*.xml" />
</fileset>
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}/site"/>
</copy>
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}/bin"/>
</chmod>
<!-- modules -->
<copy todir="${dist.dir}/gora-core">
<fileset dir="gora-core/build/gora-core"/>
</copy>
<copy todir="${dist.dir}/gora-cassandra">
<fileset dir="gora-cassandra/build/gora-cassandra"/>
</copy>
<copy todir="${dist.dir}/gora-hbase">
<fileset dir="gora-hbase/build/gora-hbase"/>
</copy>
<copy todir="${dist.dir}/gora-sql">
<fileset dir="gora-sql/build/gora-sql"/>
</copy>
</target>
<macrodef name="macro_tar" description="Worker Macro for tar">
<attribute name="param.destfile"/>
<element name="param.listofitems"/>
<sequential>
<tar compression="gzip" longfile="gnu"
destfile="@{param.destfile}">
<param.listofitems/>
</tar>
</sequential>
</macrodef>
<macrodef name="macro_zip" description="Worker Macro for zip">
<attribute name="param.destfile"/>
<element name="param.listofitems"/>
<sequential>
<zip destfile="@{param.destfile}">
<param.listofitems/>
</zip>
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="tar" depends="docs, package" description="Make release tarball">
<macro_tar param.destfile="${dist.base.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${dist.base.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${dist.base.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- Make release zipball -->
<!-- ================================================================== -->
<target name="zip" depends="package" description="Make release zipball">
<macro_zip param.destfile="${dist.base.dir}/${final.name}.zip">
<param.listofitems>
<zipfileset dir="${dist.base.dir}">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</zipfileset>
<zipfileset dir="${dist.base.dir}">
<include name="${final.name}/bin/*" />
</zipfileset>
</param.listofitems>
</macro_zip>
</target>
<!-- ================================================================== -->
<!-- Publish Targets -->
<!-- ================================================================== -->
<!-- target: publish-local-all ========================================== -->
<target name="publish-local-all" depends="-buildlist"
description="publish the projects to local ivy repo">
<subant target="publish-local" buildpathref="build-path" />
</target>
<!-- target: publish-local-all-test ===================================== -->
<target name="publish-local-all-test" depends="-buildlist"
description="publish the projects test jars to local ivy repo">
<subant target="publish-local-test" buildpathref="build-path" />
</target>
<!-- target: publish-all ================================================ -->
<target name="publish-all" depends="-buildlist"
description="compile, jar and publish all projects in the right order">
<subant target="publish" buildpathref="build-path" />
</target>
<!-- ================================================================== -->
<!-- Clean Targets -->
<!-- ================================================================== -->
<!-- target: clean-all ================================================ -->
<target name="clean-all" depends="-buildlist" description="clean all projects">
<subant target="clean" buildpathref="build-path" />
</target>
<!-- target: clean ================================================ -->
<target name="clean" depends="clean-all"
description="clean all projects">
<delete includeemptydirs="true" dir="${dist.base.dir}"/>
<delete includeemptydirs="true" dir="${build.dir}"/>
</target>
<!-- target: clean-cache ================================================ -->
<target name="clean-cache" depends="ivy-init"
description="delete ivy cache">
<ivy:cleancache />
</target>
<!-- ================================================================== -->
<!-- target: clean-docs -->
<!-- ================================================================== -->
<target name="clean-docs">
<delete dir="${build.docs}"/>
</target>
<!-- ================================================================== -->
<!-- Ivy Targets -->
<!-- ================================================================== -->
<!-- target: ivy-init ================================================ -->
<target name="ivy-init" depends="ivy-probe-antlib, ivy-init-antlib">
<ivy:settings file="${project.ivy.dir}/ivysettings.xml" />
</target>
<!-- target: ivy-probe-antlib ======================================== -->
<target name="ivy-probe-antlib">
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</condition>
</target>
<!-- target: ivy-download ============================================ -->
<target name="ivy-download" description="Download ivy">
<available file="${ivy.jar}" property="ivy.jar.found"/>
<antcall target="-ivy-download-unchecked"/>
</target>
<!-- target: ivy-download-unchecked ================================== -->
<target name="-ivy-download-unchecked" unless="ivy.jar.found">
<get src="${ivy.repo.url}" dest="${ivy.jar}" usetimestamp="true" />
</target>
<!-- target: ivy-init-antlib ========================================= -->
<target name="ivy-init-antlib" depends="ivy-download" 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>
</project>