Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

381 lines (355 sloc) 18.341 kB
<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="narya" default="compile" xmlns:artifact="urn:maven-artifact-ant">
<property name="deploy.dir" value="dist"/>
<property name="src.dir" value="src/main/java"/>
<property name="asrc.dir" value="src/main/as"/>
<property name="tsrc.dir" value="src/test/java"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<property name="maven-ant.vers" value="2.1.1"/>
<property name="maven-ant.dir" value="${user.home}/.m2/ant-support"/>
<property name="maven-ant.jar" value="${maven-ant.dir}/maven-ant-tasks-${maven-ant.vers}.jar"/>
<property name="maven-ant.url"
value="http://mirrors.ibiblio.org/pub/mirrors/apache/maven/binaries"/>
<condition property="maven-ant.exists"><available file="${maven-ant.jar}"/></condition>
<target name="-download-maven-ant" unless="maven-ant.exists">
<mkdir dir="${maven-ant.dir}"/>
<get src="${maven-ant.url}/maven-ant-tasks-${maven-ant.vers}.jar"
dest="${maven-ant.jar}" usetimestamp="true"/>
</target>
<target name="-init-maven-ant" depends="-download-maven-ant" unless="have.maven">
<property name="have.maven" value="true"/>
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="${maven-ant.jar}"/>
<artifact:pom id="pom" file="pom.xml"/>
<artifact:dependencies pathId="compile.classpath" pomRefId="pom" useScope="compile"/>
<artifact:dependencies pathId="testlibs.classpath" pomRefId="pom" useScope="test"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}">
<fileset dir="src/main/resources" includes="**"/>
</copy>
<path id="built.classpath">
<path refid="compile.classpath"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.classpath">
<path refid="testlibs.classpath"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="-preptools" depends="-prepare">
<!-- Turn off generation checking if enablegencheck hasn't already set this property -->
<property name="gencheck" value="false"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5" classpathref="compile.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<include name="com/threerings/presents/tools/**"/>
</javac>
<taskdef resource="com/threerings/presents/tools.properties" classpathref="built.classpath"/>
</target>
<target name="clean" description="Cleans out build results">
<delete dir="${classes.dir}"/>
<delete dir="${tclasses.dir}"/>
<delete dir="${deploy.dir}/docs"/>
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.jar"/></delete>
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.swc"/></delete>
</target>
<target name="distclean" description="Scorched earth clean">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="-prepare" description="Builds the Java code.">
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5" classpathref="compile.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<mkdir dir="${tclasses.dir}"/>
<copy todir="${tclasses.dir}"><fileset dir="src/test/resources" includes="**"/></copy>
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" source="1.5" target="1.5"
encoding="utf-8" classpathref="test.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<target name="-checkaslib">
<condition property="no_build_aslib">
<not><available file="${flexsdk.dir}/lib/compc.jar"/></not>
</condition>
<condition property="no_rebuild_aslib"><or>
<isset property="no_build_aslib"/>
<uptodate targetfile="${deploy.dir}/${ant.project.name}lib.swc">
<srcfiles dir="${asrc.dir}" includes="**/*.as"/>
</uptodate>
</or></condition>
</target>
<target name="-noteaslib" if="no_build_aslib"><echo>
NOTE: not building ActionScript library. Pass -Dflexsdk.dir=DIR to
activate ActionScript library build.
</echo></target>
<target name="aslib" unless="no_rebuild_aslib" depends="-prepare,-checkaslib,-noteaslib"
description="Builds the ActionScript code">
<!-- obtain our ActionScript dependencies via Maven -->
<artifact:pom id="as-pom" file="etc/as-pom.xml"/>
<artifact:dependencies filesetId="aslibs.fileset" pomRefId="as-pom" useScope="compile"/>
<copy todir="${deploy.dir}/lib">
<fileset refid="aslibs.fileset"/>
<mapper type="flatten"/>
</copy>
<!-- generate aslib-config.xml for Flash Player and general compilation -->
<copy file="etc/aslib-config.xml.in" tofile="${deploy.dir}/aslib-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
<filter token="lib_name" value="${ant.project.name}"/>
</filterset>
</copy>
<java jar="${flexsdk.dir}/lib/compc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="${deploy.dir}/aslib-config.xml"/>
<arg value="-compiler.optimize"/>
<arg value="-compiler.source-path=${asrc.dir}/"/>
<arg value="-include-sources=${asrc.dir}/"/>
<arg value="-output"/>
<arg value="${deploy.dir}/${ant.project.name}lib.swc"/>
</java>
<delete file="${deploy.dir}/aslib-config.xml"/>
</target>
<target name="javadoc" depends="-prepare" description="Builds the Java documentation">
<mkdir dir="${deploy.dir}/docs"/>
<javadoc sourcepath="${src.dir}" packagenames="com.threerings.*"
destdir="${deploy.dir}/docs" stylesheetfile="docs/stylesheet.css"
link="http://www.threerings.net/code/narya/docs/api"
additionalparam="-breakiterator" classpathref="compile.classpath">
<link href="http://java.sun.com/j2se/1.5/docs/api/"/>
<!-- ant documentation is not available online, sorry kids -->
<link href="file:///usr/share/doc/ant-doc/javadocs"/>
<link href="http://samskivert.com/code/samskivert/samskivert/docs/api"/>
</javadoc>
</target>
<target name="asdoc" unless="no_build_aslib" depends="-checkaslib"
description="Builds the ActionScript documention">
<mkdir dir="${deploy.dir}/asdocs"/>
<java classpath="${flexsdk.dir}/lib/asdoc.jar" classname="flex2.tools.ASDoc" fork="true">
<jvmarg value="-Xmx1024m"/>
<jvmarg value="-Dsun.io.useCanonCashes=false"/>
<jvmarg value="-Xbootclasspath/p:${flexsdk.dir}/asdoc/lib/xalan.jar"/>
<arg value="+flexlib=${flexsdk.dir}/frameworks"/>
<arg line="-library-path ${flexsdk.dir}/frameworks/libs"/>
<arg line="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-library-path ${deploy.dir}/lib"/>
<arg line="-doc-sources ${asrc.dir}"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
</target>
<property name="test" value=""/>
<target name="tests" depends="compile"
description="Runs unit tests. Use -Dtest=Foo to run only FooTest.">
<taskdef name="unit" classpathref="test.classpath"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<mkdir dir="${deploy.dir}/test-reports"/>
<unit printsummary="off" haltonfailure="yes">
<classpath refid="test.classpath"/>
<sysproperty key="test_dir" value="${tclasses.dir}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${deploy.dir}/test-reports">
<fileset dir="${tsrc.dir}" includes="**/*${test}*Test.java"/>
</batchtest>
</unit>
</target>
<target name="dist" depends="compile,procstream,aslib" description="Builds jar files.">
<!-- build our main jar file -->
<jar destfile="${deploy.dir}/${ant.project.name}.jar">
<fileset dir="${classes.dir}" includes="**"/>
</jar>
<!-- we export a small selection of classes for use by GWT -->
<mkdir dir="${deploy.dir}/gwt-jar"/>
<copy todir="${deploy.dir}/gwt-jar">
<fileset dir="${src.dir}">
<include name="**/web/server/*Exception.java"/>
<include name="**/web/client/*.java"/>
<include name="**/web/gwt/*.java"/>
<include name="**/web/*.gwt.xml"/>
</fileset>
</copy>
<jar basedir="${deploy.dir}/gwt-jar" destfile="${deploy.dir}/${ant.project.name}-gwt.jar"/>
<delete dir="${deploy.dir}/gwt-jar"/>
</target>
<target name="genrecord" depends="-prepare"
description="Generates fields for persistent record classes.">
<taskdef name="grecord" classname="com.samskivert.depot.tools.GenRecordTask"
classpathref="compile.classpath"/>
<!-- make sure the record class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on" optimize="${build.optimize}"
includeAntRuntime="false" deprecation="on" source="1.5" target="1.5"
classpathref="compile.classpath">
<include name="**/*Record.java"/>
</javac>
<!-- now update the source files -->
<grecord classpathref="built.classpath">
<fileset dir="${src.dir}" includes="**/*Record.java"/>
</grecord>
</target>
<target name="enablegencheck"
description="Makes the code generators fail the build if they would produce new code">
<property name="gencheck" value="true"/>
</target>
<target name="gencheck" depends="enablegencheck,gencode"
description="Fails the build if any new code would be generated"/>
<target name="gencode" depends="gendobj,genservice,genreceiver,gencppstream"
description="Runs all code generators"/>
<target name="gendobj" depends="-preptools"
description="Generates additional methods for distributed object classes">
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false" debug="on"
optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5"
classpathref="compile.classpath">
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<gendobj classpathref="built.classpath" checking="${gencheck}">
<fileset dir="${src.dir}" includes="**/*Object.java"/>
</gendobj>
</target>
<target name="genservice" depends="-preptools"
description="Generates marshaller and dispatcher classes for all invocation services">
<!-- make sure the service class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false" debug="on"
optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5"
classpathref="compile.classpath">
<include name="**/*Service.java"/>
<exclude name="**/InvocationService.java"/>
</javac>
<!-- generate services with an actionscript counterpart-->
<genservice header="lib/SOURCE_HEADER" asroot="${asrc.dir}" classpathref="built.classpath"
checking="${gencheck}">
<fileset dir="${src.dir}" includes="**/*Service.java">
<exclude name="**/RegistrationService.java"/>
<exclude name="**/InvocationService.java"/>
<exclude name="**/peer/**"/>
<exclude name="**/admin/**"/>
</fileset>
<providerless service="ChatService"/>
<providerless service="SimulatorService"/>
<providerless service="TimeBaseService"/>
</genservice>
<!-- generate java-only services -->
<genservice header="lib/SOURCE_HEADER" classpathref="built.classpath" checking="${gencheck}">
<fileset dir="${src.dir}" includes="**/peer/**/*Service.java"/>
<fileset dir="${src.dir}" includes="**/admin/**/*Service.java"
excludes="**/gwt/ConfigService.java"/>
</genservice>
<gencppservice classpathref="built.classpath" cpproot="src/cpp">
<fileset dir="${src.dir}" includes="**/RegistrationService.java"/>
</gencppservice>
</target>
<target name="genreceiver" depends="-preptools"
description="Generates sender and decoder classes for all invocation receivers">
<!-- make sure the receiver class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5"
classpathref="compile.classpath">
<include name="**/*Receiver.java"/>
<exclude name="**/InvocationReceiver.java"/>
</javac>
<!-- now generate the associated files -->
<genreceiver header="lib/SOURCE_HEADER" classpathref="built.classpath" checking="${gencheck}">
<fileset dir="${src.dir}" includes="**/*Receiver.java"
excludes="**/InvocationReceiver.java,**/SignalReceiver.java"/>
</genreceiver>
</target>
<!-- C++ streamable generation depends on a diverse enough set of classes that we just compile
everything for it -->
<target name="gencppstream" depends="-preptools,compile" description="Generates C++ streamable classes.">
<gencppstreamable classpathref="built.classpath" cpproot="src/cpp" checking="${gencheck}">
<generate class="com.threerings.presents.client.InvocationReceiver$Registration"/>
<generate class="com.threerings.presents.data.ClientObject"/>
<generate class="com.threerings.presents.dobj.DEvent"/>
<generate class="com.threerings.presents.dobj.DObject"/>
<generate class="com.threerings.presents.dobj.EntryAddedEvent"/>
<generate class="com.threerings.presents.dobj.EntryEvent"/>
<generate class="com.threerings.presents.dobj.EntryRemovedEvent"/>
<generate class="com.threerings.presents.dobj.EntryUpdatedEvent"/>
<generate class="com.threerings.presents.dobj.InvocationNotificationEvent"/>
<generate class="com.threerings.presents.dobj.InvocationRequestEvent"/>
<generate class="com.threerings.presents.dobj.NamedEvent"/>
<generate class="com.threerings.presents.net.AuthRequest"/>
<generate class="com.threerings.presents.net.AuthResponse"/>
<generate class="com.threerings.presents.net.AuthResponseData"/>
<generate class="com.threerings.presents.net.BootstrapData"/>
<generate class="com.threerings.presents.net.BootstrapNotification"/>
<generate class="com.threerings.presents.net.Credentials"/>
<generate class="com.threerings.presents.net.DownstreamMessage"/>
<generate class="com.threerings.presents.net.EventNotification"/>
<generate class="com.threerings.presents.net.ForwardEventRequest"/>
<generate class="com.threerings.presents.net.ObjectResponse"/>
<generate class="com.threerings.presents.net.PingRequest"/>
<generate class="com.threerings.presents.net.PongResponse"/>
<generate class="com.threerings.presents.net.UpstreamMessage"/>
<generate class="com.threerings.presents.net.UsernamePasswordCreds"/>
<generate class="com.threerings.util.Name"/>
</gencppstreamable>
</target>
<target name="procstream" depends="-preptools"
description="Adds readField and writeField methods to Streamable classes">
<instream outdir="${classes.dir}">
<path refid="built.classpath"/>
<fileset dir="${classes.dir}" includes="**/data/*.class"/>
<fileset dir="${classes.dir}" includes="**/net/*.class"/>
<fileset dir="${classes.dir}" includes="**/dobj/*.class"/>
<fileset dir="${classes.dir}" includes="**/util/*.class"/>
</instream>
</target>
<target name="snapshot" description="Creates a zipfile with our source distribution">
<delete file="${deploy.dir}/${ant.project.name}-snapshot.zip"/>
<mkdir dir="${deploy.dir}/snapshot/${ant.project.name}"/>
<copy todir="${deploy.dir}/snapshot/${ant.project.name}">
<fileset dir=".">
<include name="**"/>
<exclude name="${deploy.dir}/**"/>
<exclude name="${ant.project.name}-*.zip"/>
</fileset>
</copy>
<copy todir="${deploy.dir}/snapshot/${ant.project.name}/lib">
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
</copy>
<copy todir="${deploy.dir}/snapshot/${ant.project.name}/docs/api">
<fileset dir="${deploy.dir}/docs" includes="**"/>
</copy>
<zip destfile="${deploy.dir}/${ant.project.name}-snapshot.zip"
basedir="${deploy.dir}/snapshot"/>
<delete dir="${deploy.dir}/snapshot"/>
</target>
<property name="maven.deploy.repo" value="file://${user.home}/.m2/repository"/>
<target name="maven-deploy" depends="dist,tests"
description="Deploys our build artifacts to a Maven repository.">
<artifact:deploy file="${deploy.dir}/${ant.project.name}.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="pom"/>
</artifact:deploy>
<artifact:pom id="tools-pom" file="etc/tools-pom.xml"/>
<artifact:deploy file="${deploy.dir}/${ant.project.name}.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="tools-pom"/>
</artifact:deploy>
<artifact:pom id="gwt-pom" file="etc/gwt-pom.xml"/>
<artifact:deploy file="${deploy.dir}/${ant.project.name}-gwt.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="gwt-pom"/>
</artifact:deploy>
<artifact:pom id="as-pom" file="etc/as-pom.xml"/>
<artifact:deploy file="${deploy.dir}/${ant.project.name}lib.swc" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="as-pom"/>
</artifact:deploy>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.