Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
208 lines (152 sloc) 6.68 KB
<?xml version="1.0"?>
<!--
~ Copyright (c) 2009 Concurrent, Inc.
~
~ This work has been released into the public domain
~ by the copyright holder. This applies worldwide.
~
~ In case this is not legally possible:
~ The copyright holder grants any entity the right
~ to use this work for any purpose, without any
~ conditions, unless such conditions are required by law.
-->
<!--
~ This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
~ http://creativecommons.org/licenses/by-sa/3.0/us/
-->
<project name="cascading-jdbc" default="build" basedir=".">
<!-- load properties first -->
<!--<property file="${user.home}/.${ant.project.name}.build.properties" />-->
<property file="${basedir}/build.properties"/>
<property file="${basedir}/version.properties"/>
<property name="cascading.jdbc.version" value="x.y.z"/>
<!-- these are optional, only used if you uncomment the project.class.path filesets below -->
<property name="hadoop.home" location="${basedir}/../hadoop"/>
<property name="hadoop.lib" location="${hadoop.home}/lib"/>
<!-- assumes Cascading shares the same parent directory, change if necessary -->
<property name="cascading.home" location="${basedir}/../cascading"/>
<property file="${cascading.home}/version.properties"/>
<property name="cascading.release.version" value="x.y.z"/>
<property name="cascading.filename.core" value="cascading-core-${cascading.release.version}.jar"/>
<property name="cascading.filename.xml" value="cascading-xml-${cascading.release.version}.jar"/>
<property name="cascading.filename.test" value="cascading-test-${cascading.release.version}.jar"/>
<property name="cascading.libs" value="${cascading.home}/lib"/>
<property name="cascading.libs.core" value="${cascading.libs}"/>
<property name="cascading.libs.xml" value="${cascading.libs}/xml"/>
<condition property="cascading.path" value="${cascading.home}/"
else="${cascading.home}/build">
<available file="${cascading.home}/${cascading.filename.core}"/>
</condition>
<property name="cascading.lib.core" value="${cascading.path}/${cascading.filename.core}"/>
<property name="cascading.lib.xml" value="${cascading.path}/${cascading.filename.xml}"/>
<property name="cascading.lib.test" value="${cascading.path}/${cascading.filename.test}"/>
<property name="src.dir" location="${basedir}/src/java"/>
<property name="src.test" location="${basedir}/src/test"/>
<available file="${src.dir}" type="dir" property="main.available"/>
<available file="${src.test}" type="dir" property="test.available"/>
<property name="conf.dir" location="${hadoop.home}/conf"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="build.dir" location="${basedir}/build/"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="test.results" location="${build.dir}/results"/>
<property name="javac.debug" value="true"/>
<property name="dist" location="dist"/>
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${build.test}"/>
<pathelement location="${cascading.lib.core}"/>
<pathelement location="${cascading.lib.xml}"/>
<pathelement location="${cascading.lib.test}"/>
<fileset dir="${cascading.libs}">
<include name="**/*.jar"/>
</fileset>
<!--<fileset dir="${lib.dir}">-->
<!--<include name="*.jar"/>-->
<!--</fileset>-->
<fileset dir="${hadoop.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${hadoop.home}/build" erroronmissingdir="false">
<include name="*.jar"/>
</fileset>
<fileset dir="${hadoop.lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="clean">
<echo message="cleaning..."/>
<delete dir="${build.dir}"/>
<delete dir="${dist}"/>
<delete dir="${ant.project.name}.tgz"/>
</target>
<target name="build">
<echo message="building..."/>
<echo message="using cascading lib: ${cascading.lib.core}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.test}"/>
<mkdir dir="${lib.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.classes}" verbose="off" debug="${javac.debug}">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
<javac srcdir="${src.test}" destdir="${build.test}" verbose="off" debug="${javac.debug}">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.test}">
<fileset dir="${src.test}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="jar" depends="build" description="creates module jar">
<jar jarfile="${build.dir}/${ant.project.name}-${cascading.jdbc.version}.jar">
<fileset dir="${build.classes}"/>
</jar>
</target>
<target name="test" depends="build">
<echo message="running all tests..."/>
<mkdir dir="${test.results}"/>
<mkdir dir="build/test/log"/>
<junit printsummary="true" showoutput="${test.showoutput}" fork="yes" haltonerror="no" haltonfailure="no" dir="."
maxmemory="756m">
<sysproperty key="test.cluster.enabled" value="${test.cluster.enabled}"/>
<sysproperty key="test.build.data" value="data"/>
<sysproperty key="hadoop.log.dir" value="build/test/log"/>
<!--<jvmarg value="-Xdebug"/>--><!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"/>-->
<classpath>
<path refid="project.class.path"/>
<pathelement path="${java.class.path}"/>
</classpath>
<formatter type="plain" usefile="true"/>
<test name="${testcase}" todir="${test.results}" if="testcase" haltonfailure="${test.haltonerror}"/>
<batchtest todir="${test.results}" haltonfailure="${test.haltonerror}" unless="testcase">
<fileset dir="${src.test}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="dist" depends="clean" description="packages current project">
<mkdir dir="${dist}"/>
<copy todir="${dist}">
<fileset dir=".">
<include name="src/**"/>
<include name="build.xml"/>
<include name="README.txt"/>
</fileset>
</copy>
</target>
<target name="tar" depends="dist" description="creates an archive of current project">
<tar destfile="${ant.project.name}.tgz"
compression="gzip">
<tarfileset dir="dist/" prefix="${ant.project.name}">
<include name="**/**"/>
</tarfileset>
</tar>
</target>
</project>