Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
207 lines (181 sloc) 7.67 KB
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="sensei" default="dist">
<property file="build.properties" />
<property name="project.name" value="sensei" />
<path id="compile.class.path">
<fileset dir="${lib.dir}/master">
<include name="*.jar" />
</fileset>
</path>
<path id="test.class.path">
<path location="${build.dir}" />
<path location="${build.test.dir}" />
<fileset dir="${lib.test}" />
<path refid="compile.class.path" />
<path location="${resources.dir}" />
</path>
<path id="java.class.path">
<dirset dir="${build.dir}">
<include name="**" />
</dirset>
<path refid="compile.class.path" />
</path>
<target name="resolve" description="--> retrieve dependencies with ivy" depends="install-ivy">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]" />
</target>
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}" />
<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.dir}/ivy.jar" usetimestamp="true" />
</target>
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<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="clean">
<delete dir="${build.dir}" />
<delete dir="${build.test.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${logs.dir}" />
</target>
<target name="init" depends="resolve">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.test.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${logs.dir}" />
</target>
<target name="generate" depends="init">
<taskdef name="schema" classname="org.apache.avro.specific.SchemaTask">
<classpath refid="compile.class.path" />
</taskdef>
<schema destdir="${src.dir}">
<fileset dir="${avro.schema.dir}">
<include name="**/*.avsc" />
</fileset>
</schema>
</target>
<target name="compile" depends="init">
<javac debug="true" destdir="${build.dir}" compiler="javac1.6" source="1.6" target="1.6">
<src path="${src.dir}" />
<classpath refid="compile.class.path" />
</javac>
</target>
<target name="gitversion" description="--> create git version information">
<exec executable="git" outputproperty="gitversion">
<arg value="log"/>
<arg value="-1"/>
<arg value="--pretty=oneline"/>
</exec>
</target>
<target name="dist" depends="compile,gitversion">
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<jar destfile="${dist.dir}/${project.name}-${version}.jar" basedir="${build.dir}">
<fileset dir="${src.dir}"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Git-Version" value="${gitversion}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
</jar>
</target>
<target name="war" depends="dist">
<war destfile="${dist.dir}/${project.name}.war" webxml="${resources.dir}/web.xml">
<lib dir="${dist.dir}">
<include name="*.jar"/>
</lib>
<lib dir="${lib.dir}/master" excludes="servlet-api.jar">
<include name="*.jar"/>
</lib>
<classes dir="${resources.dir}" excludes="web.xml" />
<fileset dir="client-app/" />
</war>
</target>
<target name="run-server" depends="war" description="--> run server">
<java fork="true" jar="${lib.dir}/server/zoie-server.jar" failonerror="true" maxmemory="1g">
<sysproperty key="log.home" value="${logs.dir}" />
<sysproperty key="conf.dir" value="server-conf" />
<!-- <jvmarg value="-d64" /> -->
<jvmarg value="-server" />
<jvmarg value="-Xms512m" />
<jvmarg value="-Xmx1g" />
<jvmarg value="-Xloggc:${logs.dir}/gc.log" />
<jvmarg value="-XX:+PrintGCTimeStamps" />
<jvmarg value="-XX:+PrintGCDetails" />
<jvmarg value="-XX:+AggressiveHeap" />
<jvmarg value="-XX:+UseAdaptiveSizePolicy" />
<!--jvmarg value="-XX:+UseConcMarkSweepGC" /-->
<!--jvmarg value="-XX:MaxTenuringThreshold=10" /-->
<!--jvmarg value="-XX:+UseParallelGC" /-->
<jvmarg value="-XX:NewRatio=1" />
<jvmarg value="-XX:SurvivorRatio=2" />
<jvmarg value="-Dcom.sun.management.jmxremote" />
<jvmarg value="-Dcom.sun.management.jmxremote.port=9999" />
<jvmarg value="-Dcom.sun.management.jmxremote.authenticate=false" />
<jvmarg value="-Dcom.sun.management.jmxremote.ssl=false" />
<!-- uncomment to turn on debugging
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8886,server=y,suspend=y" />
-->
<!--jvmarg value="-agentpath:/Users/xgu/Downloads/YourKit_Java_Profiler_8.0.18.app/bin/mac/libyjpagent.jnilib" /-->
<!-- uncomment to turn on yourkit profiling
<jvmarg value="-agentlib:yjpagent" />
-->
</java>
</target>
<target name="test-build" depends="dist">
<javac debug="true" destdir="${build.test.dir}" compiler="javac1.6" source="1.6" target="1.6">
<src path="${test.src.dir}" />
<classpath refid="java.class.path" />
</javac>
</target>
<target name="test" description="Runs JUnit Tests -- use -Dtests.to.run=testA,testB,... to run tests selectively" depends="test-build">
<echo>=== Running JUnit Tests ===</echo>
<mkdir dir="${test.report.dir}" />
<mkdir dir="${test.html.dir}" />
<junit printsummary="yes" showoutput="yes">
<sysproperty key="log.home" value="${logs.dir}" />
<sysproperty key="idx.dir" value="data/cardata" />
<sysproperty key="uididx.dir" value="data/uiddata" />
<sysproperty key="log4j.configuration" value="${resources.dir}/log4j.properties" />
<jvmarg value="-server" />
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx1g" />
<!-- debug
<jvmarg value="-Djava.compiler=NONE" />
<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=7777,server=y,suspend=y" />
-->
<!-- classpath must include all jar dependencies and classes -->
<classpath refid="test.class.path" />
<!-- formatter to use for output -->
<formatter type="xml" />
<batchtest fork="yes" todir="${test.report.dir}">
<fileset dir="${test.src.dir}">
<include name="**/SenseiTestSuite.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.html.dir}">
<fileset dir="${test.report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.html.dir}" format="frames" />
</junitreport>
</target>
<target name="protobuf" description="Generate source files from .proto files">
<pathconvert property="proto.sources" pathsep=" ">
<path id="proto-files">
<fileset dir="${protobuf.schema.dir}" />
</path>
</pathconvert>
<property name="proto.path" location="${protobuf.schema.dir}"/>
<exec executable="protoc" failonerror="true">
<arg value="--proto_path=${proto.path}"/>
<arg value="--java_out=${src.dir}"/>
<arg line="${proto.sources}"/>
</exec>
</target>
</project>