2011-07-06 07:45:16 -07:00

186 lines
6.0 KiB
XML

<?xml version="1.0"?>
<project name="java-driver" xmlns:ivy="antlib:org.apache.ivy.ant" default="fastdist" basedir=".">
<property environment="env" />
<property name="version.identifier" value="4.04" />
<property name="application.description" value="Wordnik Java Driver"/>
<property name="application.name" value="java-driver"/>
<condition property="build.common.dir" value="${env.BUILD_COMMON}">
<isset property="env.BUILD_COMMON" />
</condition>
<echo message="using build common dir: ${build.common.dir}"/>
<!-- cleans up the dist -->
<target name="dist.clean">
<delete quiet="true" dir="dist"/>
<delete quiet="true" file="dist.zip"/>
</target>
<target name="ci.deploy">
<delete dir="/opt/wordnik/wordnik-java" />
<copy todir="/opt/wordnik/wordnik-java">
<fileset dir="dist" />
</copy>
</target>
<!-- production api server smoke test -->
<target name="test.production" depends="test.compile" description="tests against beta server">
<junit printsummary="yes" fork="true">
<formatter type="xml" />
<classpath refid="classpath.test" />
<jvmarg value="-DconfigFile=${build.common.dir}/test-config/config.xml"/>
<jvmarg value="-DloggerPath=${build.common.dir}/test-config/log4j.properties"/>
<jvmarg value="-Xmx800m" />
<sysproperty key="rulePath"
file="dist/data" />
<batchtest todir="${reports.tests}">
<fileset dir="build/test/java"
includes="**/test/production/**/*Test.class"
/>
</batchtest>
</junit>
</target>
<!-- generates the classes -->
<target name="generate" description="generates API and model classes">
<delete>
<fileset dir="src/main/java/com/wordnik/api" includes="*.java"/>
<fileset dir="src/main/java/com/wordnik/model" includes="*.java"/>
</delete>
<antcall target="gen-compile"/>
<java classname="com.wordnik.codegen.DriverCodeGenerator">
<arg value="-r" />
<classpath>
<pathelement location="build/main/java" />
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</java>
<antcall target="compile"/>
</target>
<target name="gen-compile" description="builds the module for generating classes">
<delete quiet="true" file="build/${organization}-${release.module}-*.jar" />
<mkdir dir="build" />
<mkdir dir="build/main" />
<mkdir dir="build/main/java" />
<javac srcdir="src/main/java" debug="true" destdir="build/main/java">
<classpath>
<pathelement location="build/main/java" />
<fileset dir="lib">
<include name="*.jar" />
</fileset>
<fileset dir="lib/ext">
<include name="*.jar" />
</fileset>
</classpath>
<include name="**/*.java" />
<exclude name="**/ext/*.java"/>
</javac>
</target>
<target name="runtests" description="runs the test cases" depends="generate, test.compile">
<java classname="com.wordnik.test.APITestRunner">
<arg value="JAVA" />
<classpath>
<pathelement location="build/main/java" />
<pathelement location="build/test/java" />
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</java>
</target>
<target name="run_python_tests" description="runs python test cases" depends="generate, test.compile">
<java classname="com.wordnik.test.APITestRunner">
<arg value="PYTHON" />
<classpath>
<pathelement location="build/main/java" />
<pathelement location="build/test/java" />
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</java>
</target>
<!-- creates a distribution of the api server -->
<target name="dist" depends="compile, generate, runtests">
<!-- make dist -->
<delete dir="dist"/>
<mkdir dir="dist"/>
<mkdir dir="dist/lib"/>
<mkdir dir="dist/logs"/>
<!-- copy all jars -->
<copy todir="dist/lib">
<fileset dir="lib">
<include name="*.jar"/>
<!-- skip the test jars -->
<exclude name="*-test-*.jar"/>
</fileset>
<fileset dir="build">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="dist/lib">
<fileset dir="lib/ext"/>
</copy>
<!-- unzip the text-data -->
<unzip dest="dist">
<fileset dir="lib">
<include name="wordnik-*.zip"/>
</fileset>
</unzip>
<mkdir dir="dist/conf"/>
<!-- clean up old dists -->
<delete quiet="true">
<fileset dir=".">
<include name="wordnik-java-*.zip"/>
</fileset>
</delete>
<zip destfile="${organization}-${release.module}-${release.version}.zip">
<zipfileset dir="dist" prefix="${release.module}-${release.version}" includes="**/*"/>
</zip>
<copy todir="build">
<fileset dir=".">
<include name="wordnik-*.zip"/>
</fileset>
</copy>
</target>
<target name="jar-mapred" depends="compile">
<delete dir="build/main/java/lib"/>
<mkdir dir="build/main/java/lib"/>
<copy todir="build/main/java/lib">
<fileset dir="lib/ext"/>
</copy>
<copy todir="build/main/java/lib">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="build">
<include name="*.jar"/>
</fileset>
</copy>
<jar basedir="build/main/java" file="import-logs.jar"/>
<delete dir="build/main/java/lib"/>
</target>
<import file="${build.common.dir}/ant/ant-common.xml" />
<import file="${build.common.dir}/ant/ant-test.xml" />
</project>