Find file
Fetching contributors…
Cannot retrieve contributors at this time
373 lines (318 sloc) 16.5 KB
<project name="ivory" default="scripts" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>Ivory: A Hadoop toolkit for web-scale information retrieval</description>
<property name="lib.dir" value="lib" />
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="dist.dir" value="dist"/>
<property name="javadoc.dir" location="docs/api/" />
<property name="test.dir" value="test"/>
<property name="test.junit.dir" location="${test.dir}/junit" />
<property name="regression.complete.dir" location="${test.dir}/regression.complete" />
<property name="regression.quick.dir" location="${test.dir}/regression.quick" />
<property name="integration.dir" location="${test.dir}/integration" />
<property name="version" value="0.6.0"/>
<!-- paths used for compilation and run -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<path location="${build.dir}" />
</path>
<property name="ivy.install.version" value="2.2.0"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="ivy.settings.file" value="${basedir}/ivy/ivysettings.xml" />
<property name="ivy.dep.file" value="${basedir}/ivy/ivy.xml" />
<property name="maven.ant.task.version" value="2.1.2"/>
<property name="maven.jar.dir" value="${basedir}/${lib.dir}"/>
<property name="maven.jar.file" value="${maven.jar.dir}/maven.jar"/>
<!-- define Maven coordinates, repository url and artifacts name etc -->
<property name="groupId" value="cc.ivory" />
<property name="artifactId" value="ivory" />
<property name="version" value="${version}" />
<property name="maven-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
<property name="maven-repository-id" value="sonatype-nexus-staging" />
<property name="maven-jar" value="${dist.dir}/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist.dir}/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist.dir}/${artifactId}-${version}-sources.jar" />
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="resolve" depends="install-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve/>
</target>
<!-- download maven from web site so that it can be used even without any special installation -->
<target name="download-maven" depends="init" unless="skip.download">
<mkdir dir="${maven.jar.dir}"/>
<echo message="installing maven ant tasks..."/>
<get src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/${maven.ant.task.version}/maven-ant-tasks-${maven.ant.task.version}.jar"
dest="${maven.jar.file}" usetimestamp="true"/>
</target>
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<target name="install-maven" depends="download-maven" description="--> install ivy">
<path id="maven.lib.path">
<fileset dir="${maven.jar.dir}" includes="*.jar"/>
</path>
<taskdef uri="antlib:org.apache.maven.artifact.ant" classpathref="maven.lib.path"/>
</target>
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<ivy:report todir="${build.dir}"/>
</target>
<target name="init">
<tstamp />
<condition property="platform" value="unix">
<os family="unix" />
</condition>
<condition property="platform" value="unix">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${lib.dir}" />
</target>
<target name="compile" depends="init,resolve" description="compile the source">
<!-- echo message="${toString:classpath}"/ -->
<javac classpathref="lib.path.id" srcdir="${src.dir}/java/main" destdir="${build.dir}" optimize="on" debug="on">
<!-- compilerarg value="-Xlint:unchecked"/ uncomment this to check for generics -->
</javac>
<javac classpathref="lib.path.id" srcdir="${src.dir}/java/test" destdir="${build.dir}" optimize="on" debug="on" />
<javac classpathref="lib.path.id" srcdir="${src.dir}/java/regression" destdir="${build.dir}" optimize="on" debug="on" />
<javac classpathref="lib.path.id" srcdir="${src.dir}/java/integration" destdir="${build.dir}" optimize="on" debug="on" />
<!-- javac classpathref="classpath" srcdir="${src.dir}/sandbox" destdir="${build.dir}" optimize="on" debug="on" -->
<!-- compilerarg value="-Xlint:unchecked"/ uncomment this to check for generics -->
<!-- /javac -->
<!--copy todir="${build.dir}">
<fileset dir="${src.dir}/dist" excludes="**/*.java" />
<fileset dir="${src.dir}/private" excludes="**/*.java" />
</copy-->
</target>
<target name="jar" depends="compile" description="generate the distribution">
<jar jarfile="${dist.dir}/ivory-${version}.jar" basedir="${build.dir}" />
</target>
<target name="dist" depends="jar,javadoc" description="generate the distribution">
<jar jarfile="${dist.dir}/ivory-${version}-sources.jar" basedir="${src.dir}" />
<jar jarfile="${dist.dir}/ivory-${version}-javadoc.jar" basedir="${javadoc.dir}" />
</target>
<target name="jarjar" depends="compile">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="lib/jarjar-1.0.jar"/>
<jarjar jarfile="ivory-dist.jar">
<fileset dir="${build.dir}"/>
</jarjar>
</target>
<target name="clean" description="clean up">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${lib.dir}" />
<delete dir="${test.dir}" />
<delete dir="${javadoc.dir}" />
</target>
<target name="test" depends="jar" description="Execute Unit Tests">
<mkdir dir="${test.junit.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="2048m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${test.junit.dir}">
<fileset dir="${build.dir}">
<include name="**/*Test.class" />
<exclude name="ivory/regression/*.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.junit.dir}">
<fileset dir="${test.junit.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${test.junit.dir}" />
</junitreport>
</target>
<target name="regression-quick" depends="jar" description="Run regression tests">
<mkdir dir="${regression.quick.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="2048m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${regression.quick.dir}">
<fileset dir="${build.dir}">
<include name="ivory/regression/basic/Robust04_Basic.class" />
<include name="ivory/regression/basic/Robust04_WSD.class" />
<include name="ivory/regression/basic/Wt10g_Basic.class" />
<include name="ivory/regression/basic/Gov2_Basic.class" />
<include name="ivory/regression/basic/Web09catB_All.class" />
<include name="ivory/regression/sigir2011/Clue_Cascade.class" />
<include name="ivory/regression/sigir2011/Gov2_Cascade.class" />
<include name="ivory/regression/sigir2011/Wt10g_Cascade.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${regression.quick.dir}">
<fileset dir="${regression.quick.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${regression.quick.dir}" />
</junitreport>
<mail messageMimeType="text/html" messageFile="${regression.quick.dir}/junit-noframes.html" tolist="umd-ivory@googlegroups.com" subject="Ivory regression test results (quick)" mailhost="smtp.umiacs.umd.edu" from="jimmylin@umd.edu" />
</target>
<target name="regression-complete" depends="jar" description="Run regression tests">
<mkdir dir="${regression.complete.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="2048m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${regression.complete.dir}">
<fileset dir="${build.dir}">
<include name="ivory/regression/**/*.class" />
<exclude name="ivory/regression/GroundTruth*.class" />
<exclude name="ivory/regression/RegressionUtils.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${regression.complete.dir}">
<fileset dir="${regression.complete.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${regression.complete.dir}" />
</junitreport>
<mail messageMimeType="text/html" messageFile="${regression.complete.dir}/junit-noframes.html" tolist="umd-ivory@googlegroups.com" subject="Ivory regression test results (complete)" mailhost="smtp.umiacs.umd.edu" from="jimmylin@umd.edu" />
</target>
<target name="integration" depends="jar" description="Run integration tests">
<mkdir dir="${integration.dir}" />
<junit printsummary="yes" fork="yes" maxmemory="2048m">
<sysproperty key="java.library.path" path="${lib.dir}" />
<sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser" />
<classpath refid="run.path.id" />
<formatter type="xml" />
<batchtest todir="${integration.dir}">
<fileset dir="${build.dir}">
<include name="ivory/integration/**/Verify*.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${integration.dir}">
<fileset dir="${integration.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" styledir="etc/" todir="${integration.dir}" />
</junitreport>
</target>
<target name="javadoc">
<javadoc destdir="${javadoc.dir}" access="public" use="false" notree="false" nonavbar="false" noindex="false" splitindex="no" author="true" version="true" nodeprecatedlist="true" nodeprecated="true" classpathref="run.path.id">
<fileset dir="src">
<include name="java/main/**/*.java" />
<exclude name="java/main/ivory/util/AnnotateClueRunAllWithURLs.java" />
<exclude name="java/main/ivory/util/AnnotateClueRunWithURLs.java" />
<exclude name="java/main/**/*Test.java" />
<exclude name="java/main/uk/**/*.java" />
<exclude name="java/main/org/**/*.java" />
</fileset>
<link href="http://download.oracle.com/javase/6/docs/api/" />
<link href="http://hadoop.apache.org/common/docs/current/api/" />
<link href="http://www.umiacs.umd.edu/~jimmylin/Cloud9/docs/api//" />
</javadoc>
</target>
<target name="scripts" depends="jar">
<pathconvert property="run.path.id" refid="run.path.id" targetos="${platform}" />
<condition property="suffix" value="sh">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="suffix" value="bat">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="param_prefix" value="$">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="param_prefix" value="%">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="java" value="java">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="java" value="java">
<equals arg1="${platform}" arg2="windows" />
</condition>
<condition property="cp_sep" value=":">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="cp_sep" value=";">
<equals arg1="${platform}" arg2="windows" />
</condition>
<property name="java_command" value="${java} -Xmx2g -classpath &quot;${run.path.id}&quot;" />
<condition property="script_prefix" value="#!/bin/sh${line.separator}if test -s ~/.bashrc${line.separator}then${line.separator}source ~/.bashrc${line.separator}fi${line.separator}">
<equals arg1="${platform}" arg2="unix" />
</condition>
<condition property="script_prefix" value="">
<equals arg1="${platform}" arg2="windows" />
</condition>
<echo file="./etc/junit.${suffix}" message="${script_prefix}" />
<echo file="./etc/junit.${suffix}" message="${java_command} org.junit.runner.JUnitCore " append="true" />
<echo file="./etc/junit.${suffix}" message="${param_prefix}1" append="true" />
<echo file="./etc/run.${suffix}" message="${script_prefix}" />
<echo file="./etc/run.${suffix}" message="${java_command} " append="true" />
<echo file="./etc/run.${suffix}" message="${param_prefix}1 ${param_prefix}2 ${param_prefix}3 ${param_prefix}4 ${param_prefix}5 ${param_prefix}6 ${param_prefix}7 ${param_prefix}8 ${param_prefix}9" append="true" />
</target>
<target name="gen-pom" depends="install-ivy">
<ivy:makepom ivyfile="ivy/ivy.xml" pomfile="ivory.pom" />
</target>
<target name="publish-local" depends="jar" description="publish jar/source to maven repo mounted at ~/.m2/repository">
<ivy:publish resolver="local-m2-publish" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist.dir}/[artifact]-[revision].[ext]"/>
<artifacts pattern="pom.xml"/>
</ivy:publish>
</target>
<target name="deploy" depends="dist,install-maven" description="deploy to Nexus">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>