Files
narya/build.xml
T
Michael Bayne bf77cb1520 Moved location services implementation into LocationManager so that
LocationProvider can be an interface like its brothers and sisters.

Modified the place registry to create PlaceManager instances using the injector
so that we can inject dependencies into managers. Also modified the custom
classloader functionality so that it can/will circumvent this process
entirely. It's not possible to inject using a custom classloader and one
certainly would not want to do so.

Unfortunately this means we can't inject some basic managers into PlaceManager
because it needs to work for games loaded into a sandboxed classloader, but the
big win is that in everything other than GameManager and PlaceManager, we can
inject to our heart's content.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5168 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-06-08 17:18:26 +00:00

384 lines
16 KiB
XML

<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="narya" default="compile" basedir=".">
<!-- import overriding properties -->
<property file="build.properties"/>
<!-- configuration parameters -->
<property name="lib.name" value="narya"/>
<property name="deploy.dir" value="dist"/>
<property name="savedoc.dir" value="docs"/>
<property name="javadoc.home" value="${deploy.dir}/docs"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="libs.dir" value="lib"/>
<import file="etc/libs-incl.xml"/>
<!-- declare our classpath business -->
<path id="classpath">
<pathelement location="${classes.dir}"/>
<fileset dir="${deploy.dir}/lib" includes="**/*.jar"/>
</path>
<!-- generates fields for persistent record classes -->
<target name="genrecord" depends="prepare">
<taskdef name="grecord" classname="com.samskivert.jdbc.depot.tools.GenRecordTask"
classpathref="classpath"/>
<!-- make sure the record class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}" debug="on" optimize="${build.optimize}"
deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Record.java"/>
</javac>
<!-- now update the source files -->
<grecord classpathref="classpath">
<fileset dir="src/java" includes="**/*Record.java"/>
</grecord>
</target>
<!-- generates additional methods for distributed object classes -->
<target name="gendobj" depends="prepare">
<taskdef name="dobj" classpathref="classpath"
classname="com.threerings.presents.tools.GenDObjectTask"/>
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}" includeAntRuntime="false" debug="on"
optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<dobj classpathref="classpath">
<fileset dir="src/java" includes="**/*Object.java"/>
</dobj>
</target>
<!-- generates marshaller and dispatcher classes for all invocation service declarations -->
<target name="genservice">
<taskdef name="service" classpathref="classpath"
classname="com.threerings.presents.tools.GenServiceTask"/>
<!-- make sure the service class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}" includeAntRuntime="false" debug="on"
optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Service.java"/>
<exclude name="**/InvocationService.java"/>
</javac>
<!-- now generate the associated files -->
<service header="lib/SOURCE_HEADER" asroot="src/as" classpathref="classpath">
<fileset dir="src/java" includes="**/*Service.java">
<exclude name="**/InvocationService.java"/>
<exclude name="**/peer/**"/>
<exclude name="**/admin/**"/>
</fileset>
<providerless service="ChatService"/>
<providerless service="SimulatorService"/>
<providerless service="TimeBaseService"/>
</service>
<service header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="src/java" includes="**/peer/**/*Service.java"/>
<fileset dir="src/java" includes="**/admin/**/*Service.java"/>
<providerless service="AdminService"/>
</service>
</target>
<!-- generates sender and decoder classes for all invocation receiver declarations -->
<target name="genreceiver">
<taskdef name="receiver" classpathref="classpath"
classname="com.threerings.presents.tools.GenReceiverTask"/>
<!-- make sure the receiver class files are all compiled -->
<javac srcdir="src/java" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<include name="**/*Receiver.java"/>
<exclude name="**/InvocationReceiver.java"/>
</javac>
<!-- now generate the associated files -->
<receiver header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="src/java" includes="**/*Receiver.java"
excludes="**/InvocationReceiver.java"/>
</receiver>
</target>
<!-- adds readField and writeField methods to Stremable classes -->
<target name="procstream">
<taskdef name="instream" classpathref="classpath"
classname="com.threerings.presents.tools.InstrumentStreamableTask"/>
<!-- now instrument the associated files -->
<instream outdir="${classes.dir}">
<path refid="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>
<!-- generates ActionScript versions of our Streamable classes -->
<target name="genascript">
<taskdef name="genscript" classpathref="classpath"
classname="com.threerings.presents.tools.GenActionScriptTask"/>
<genscript header="lib/SOURCE_HEADER" asroot="src/as">
<fileset dir="src/java" includes="**/data/*.java"/>
</genscript>
</target>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${javadoc.home}"/>
<copy todir="${classes.dir}">
<fileset dir="src/java" includes="**/*.properties"/>
<fileset dir="src/java" includes="**/*.tmpl"/>
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset refid="${lib.name}.libs"/>
</copy>
</target>
<!-- cleans out the intermediate build files -->
<target name="clean" depends="common-clean">
<delete dir="${deploy.dir}/classes"/>
<delete dir="${deploy.dir}/docs"/>
<delete failonerror="false" file="src/as/com/threerings/util/env/Environment.as"/>
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.jar"/></delete>
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.swc"/></delete>
</target>
<!-- wipes the entire build directory clean -->
<target name="distclean" depends="common-clean">
<delete dir="${deploy.dir}"/>
<delete failonerror="false" file="src/as/com/threerings/util/env/Environment.as"/>
</target>
<!-- common clean tasks -->
<target name="common-clean">
<ant dir="tests" target="clean"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="prepare">
<javac srcdir="src/java" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="{$build.optimize}" deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<!-- checks whether our Flash library needs building -->
<target name="checkaslib">
<condition property="no_build_aslib"><or>
<not><available file="${flexsdk.dir}/lib/compc.jar"/></not>
<and>
<uptodate targetfile="${deploy.dir}/${lib.name}lib.swc">
<srcfiles dir="src/as" includes="**/*.as"/>
<srcfiles dir="src/as" includes="**/Environment.as-fp"/>
</uptodate>
</and>
</or></condition>
</target>
<!-- builds our Flash library -->
<target name="aslib" unless="no_build_aslib" depends="checkaslib">
<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_dir" value="${lib.name}"/>
</filterset>
</copy>
<copy overwrite="true" file="src/as/com/threerings/util/env/Environment.as-fp"
tofile="src/as/com/threerings/util/env/Environment.as"/>
<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=src/as/"/>
<arg value="-include-sources=src/as/"/>
<arg value="-output"/>
<arg value="${deploy.dir}/${lib.name}lib.swc"/>
</java>
<delete file="${deploy.dir}/aslib-config.xml"/>
<delete file="src/as/com/threerings/util/env/Environment.as"/>
</target>
<!-- checks whether our thane library needs building -->
<target name="checkabclib">
<condition property="no_build_abclib"><or>
<not><available classname="macromedia.asc.embedding.ScriptCompiler"
classpathref="classpath"/></not>
<uptodate targetfile="${deploy.dir}/${lib.name}-abc.abc">
<srcfiles dir="src/as" includes="**/*.as"/>
<srcfiles dir="src/as/com/threerings/util/env" includes="Environment.as-tm"/>
<srcfiles dir="etc" includes="asc-files-*.txt"/>
<srcfiles dir="${deploy.dir}/lib" includes="*.abc"/>
</uptodate>
</or></condition>
</target>
<!-- builds our thane library -->
<target name="abclib" unless="no_build_abclib" depends="checkabclib">
<taskdef name="asc" classname="flex.ant.AscTask" classpathref="classpath"/>
<copy overwrite="true" file="src/as/com/threerings/util/env/Environment.as-tm"
tofile="src/as/com/threerings/util/env/Environment.as"/>
<asc as3="true" strict="true" classpathref="classpath" use="AS3">
<import dir="${deploy.dir}/lib">
<include name="tamarin-builtin*.abc"/>
<include name="thane*.abc"/>
</import>
<in dir="src/as" includes="com/threerings/util/env/Environment.as"/>
<in dir="src/as"><includesfile name="etc/asc-files-00.txt"/></in>
<in dir="src/as"><includesfile name="etc/asc-files-01.txt"/></in>
<in dir="src/as"><includesfile name="etc/asc-files-02.txt"/></in>
<in dir="src/as"><includesfile name="etc/asc-files-03.txt"/></in>
<filespec dir="etc" includes="empty.as"/>
</asc>
<delete file="src/as/com/threerings/util/env/Environment.as"/>
<move overwrite="true" file="etc/empty.abc" tofile="${deploy.dir}/${lib.name}-abc.abc"/>
</target>
<!-- build the native libraries -->
<condition property="isunix"><os family="unix"/></condition>
<target name="ninstall" depends="prepare" if="isunix">
<echo level="info" message="Doing native compilation on ${os.name}..."/>
<exec dir="src/java/com/threerings/util/signal/${os.name}" executable="make">
<arg line="install"/>
</exec>
</target>
<!-- build the javadoc documentation -->
<target name="javadoc" depends="prepare">
<javadoc sourcepath="src/java" packagenames="com.threerings.*"
destdir="${javadoc.home}" stylesheetfile="docs/stylesheet.css"
additionalparam="-breakiterator"
link="http://www.threerings.net/code/narya/docs/api">
<classpath refid="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>
<copy todir="${javadoc.home}">
<fileset dir="src/java" includes="**/*.png"/>
</copy>
</target>
<!-- builds the javadocs and stuffs them in a directory where they -->
<!-- won't be blown away when we do "clean" next time -->
<target name="savedoc" depends="javadoc">
<delete dir="${savedoc.dir}/api"/>
<copy todir="${savedoc.dir}/api">
<fileset dir="${javadoc.home}" includes="**/*"/>
</copy>
</target>
<!-- builds the various tests -->
<target name="tests">
<ant dir="tests" target="compile"/>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,prepare,compile,aslib,abclib,ninstall,javadoc,tests,dist"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile,procstream,aslib,abclib,ninstall,tests">
<!-- build our various jar files -->
<jar destfile="${deploy.dir}/${lib.name}-base.jar">
<fileset dir="${classes.dir}" includes="com/threerings/NaryaLog**"/>
<fileset dir="${classes.dir}" includes="com/threerings/io/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/util/**"
excludes="**/*.c,**/Makefile,**/*.h"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-distrib.jar">
<fileset dir="${classes.dir}" includes="com/threerings/presents/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/crowd/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/admin/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/bureau/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-tests.jar">
<fileset dir="tests/${classes.dir}" includes="com/threerings/**"/>
</jar>
</target>
<!-- various bits used by the retroweaver tasks -->
<property name="inpre" value="${deploy.dir}/${lib.name}"/>
<property name="outpre" value="${deploy.dir}/retro/${lib.name}"/>
<!-- a helper task for 'retro' -->
<target name="vweave">
<taskdef name="weave" classpathref="classpath"
classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
<path id="retrocp">
<pathelement location="/usr/local/jdk1.4/jre/lib/rt.jar"/>
<fileset dir="lib" includes="**/*.jar"/>
<fileset dir="${deploy.dir}/retro" includes="*.jar"/>
</path>
<weave inputjar="${inpre}-${which}.jar" outputjar="${outpre}-${which}.jar"
failonerror="true">
<classpath refid="retrocp"/>
</weave>
</target>
<!-- converts our 1.5 code to a 1.4 compatible format -->
<target name="retro" depends="dist">
<taskdef name="weave" classpathref="classpath"
classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
<mkdir dir="${deploy.dir}/retro"/>
<!-- we weave everything a first time without verification so that -->
<!-- interdependencies will resolve the second time -->
<weave inputjar="${inpre}-base.jar" outputjar="${outpre}-base.jar"/>
<weave inputjar="${inpre}-distrib.jar" outputjar="${outpre}-distrib.jar"/>
<!-- now weave again with the verifier to check for unweavable 1.5isms -->
<antcall target="vweave"><param name="which" value="base"/></antcall>
<antcall target="vweave"><param name="which" value="distrib"/></antcall>
</target>
<!-- generate a class hierarchy diagram -->
<target name="hierviz" depends="prepare,compile">
<taskdef name="viztool" classname="com.samskivert.viztool.DriverTask"/>
<viztool visualizer="com.samskivert.viztool.hierarchy.HierarchyVisualizer"
pkgroot="com.threerings.miso" classes="com.threerings.miso.*"
output="hierviz.ps">
<classpath refid="classpath"/>
</viztool>
</target>
<!-- generate a class hierarchy diagram -->
<target name="sumgen" depends="prepare,compile">
<taskdef name="viztool" classname="com.samskivert.viztool.DriverTask"/>
<viztool visualizer="com.samskivert.viztool.summary.SummaryVisualizer"
pkgroot="com.threerings.miso"
classes="com.threerings.miso.*Scene.*"
output="summary.ps">
<classpath refid="base.classpath"/>
</viztool>
</target>
<!-- creates a zipfile with our source distribution -->
<target name="snapshot">
<echo message="You may want to stop and run 'ant savedoc' first."/>
<delete file="${deploy.dir}/${lib.name}-snapshot.zip"/>
<mkdir dir="${deploy.dir}/snapshot/${lib.name}"/>
<copy todir="${deploy.dir}/snapshot/${lib.name}">
<fileset dir=".">
<include name="**"/>
<exclude name="dist/**"/>
<exclude name="tests/dist/**"/>
<exclude name="${lib.name}-*.zip"/>
</fileset>
</copy>
<copy todir="${deploy.dir}/snapshot/${lib.name}/lib">
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
</copy>
<copy todir="${deploy.dir}/snapshot/${lib.name}/docs/api">
<fileset dir="${deploy.dir}/docs" includes="**"/>
</copy>
<zip destfile="${deploy.dir}/${lib.name}-snapshot.zip" basedir="${deploy.dir}/snapshot"/>
<delete dir="${deploy.dir}/snapshot"/>
</target>
</project>