Files
vilya/build.xml
T
Michael Bayne e7d65a6b57 Added asdoc target.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@809 c613c5cb-e716-0410-b11b-feb51c14d237
2009-03-30 23:09:45 +00:00

429 lines
18 KiB
XML

<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="vilya" default="compile" basedir=".">
<!-- import overriding properties -->
<property file="build.properties"/>
<!-- configuration parameters -->
<property name="lib.name" value="vilya"/>
<property name="deploy.dir" value="dist"/>
<property name="savedoc.dir" value="docs"/>
<!-- derived properties -->
<property name="javadoc.home" value="${deploy.dir}/docs"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<!-- import some targets to enumerate library dependencies -->
<property name="libs.dir" value="lib"/>
<import file="etc/libs-incl.xml"/>
<import file="etc/depends-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.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">
<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>
<!-- generate our services that have no ActionScript counterpart -->
<service header="lib/SOURCE_HEADER" classpathref="classpath">
<fileset dir="src/java">
<include name="**/stage/client/*Service.java"/>
<include name="**/puzzle/client/*Service.java"/>
<include name="**/micasa/simulator/client/*Service.java"/>
<include name="**/micasa/lobby/*Service.java"/>
<include name="**/parlor/tourney/client/*Service.java"/>
</fileset>
<providerless service="SimulatorService"/>
</service>
<!-- generate our services that have an ActionScript counterpart -->
<service header="lib/SOURCE_HEADER" asroot="src/as" classpathref="classpath">
<fileset dir="src/java">
<include name="**/client/*Service.java"/>
<exclude name="**/stage/client/*Service.java"/>
<exclude name="**/puzzle/client/*Service.java"/>
<exclude name="**/micasa/simulator/client/*Service.java"/>
<exclude name="**/parlor/tourney/client/*Service.java"/>
</fileset>
</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="**/*.class"/>
</instream>
</target>
<!-- generates ActionScript versions of our Streamable classes -->
<target name="genascript">
<taskdef name="genscript" classpathref="classpath"
classname="com.threerings.presents.tools.GenActionScriptTask"/>
<!-- now generate the associated files -->
<genscript header="lib/SOURCE_HEADER" asroot="src/as">
<fileset dir="src/java">
<include name="**/parlor/data/*.java"/>
<include name="**/parlor/**/data/*.java"/>
<exclude name="**/parlor/game/data/GameConfig.java"/> <!-- fiddly bits -->
<exclude name="**/parlor/tourney/**"/>
<include name="**/ezgame/data/*.java"/>
<include name="**/whirled/data/*.java"/>
<include name="**/whirled/**/data/*.java"/>
<exclude name="**/whirled/spot/data/Cluster.java"/> <!-- fiddly bits -->
</fileset>
</genscript>
</target>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${classes.dir}/rsrc"/>
<mkdir dir="${javadoc.home}"/>
<copy todir="${classes.dir}">
<fileset dir="src/java" includes="**/*.properties"/>
<fileset dir="src/java" includes="**/*.tmpl"/>
</copy>
<copy todir="${classes.dir}/rsrc">
<fileset dir="rsrc" includes="**/*" excludes="**/bundles/**"/>
</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"><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}"/>
</target>
<!-- common clean tasks -->
<target name="common-clean">
<ant dir="tests" target="clean"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="check-available,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"/>
<exclude name="com/threerings/**/tools/xml/**" unless="build.xml"/>
<exclude name="com/threerings/**/tools/editor/**" unless="build.xml"/>
<exclude name="com/threerings/**/tools/viewer/**" unless="build.xml"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
</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>
<uptodate targetfile="${deploy.dir}/${lib.name}lib.swc">
<srcfiles dir="src/as" includes="**/*.as"/>
</uptodate>
</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" value="${lib.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=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"/>
</target>
<!-- builds 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/vilya/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"/>
<link href="http://www.threerings.net/code/narya/docs/api"/>
<link href="http://www.threerings.net/code/nenya/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 ActionScript documention -->
<target name="asdoc" unless="no_build_aslib" depends="checkaslib">
<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"/>
<jvmarg value="-Dos.name=Windows"/>
<arg value="+flexlib=${flexsdk.dir}/frameworks"/>
<arg line="-library-path ${flexsdk.dir}/frameworks/libs"/>
<arg line="-library-path ${deploy.dir}/lib/naryalib-0.0-SNAPSHOT.swc"/>
<arg line="-library-path ${deploy.dir}/lib/nenyalib-0.0-SNAPSHOT.swc"/>
<arg line="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-doc-sources src/as"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
</target>
<!-- builds the various tests -->
<target name="tcompile">
<ant dir="tests" target="compile"/>
</target>
<!-- builds and runs our tests -->
<target name="tests">
<ant dir="tests" target="test"/>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,dist,javadoc,dist"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile,tcompile,procstream,aslib">
<!-- build our various jar files -->
<jar destfile="${deploy.dir}/${lib.name}-parlor.jar">
<fileset dir="${classes.dir}" includes="rsrc/i18n/game/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/parlor/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/ezgame/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-puzzle.jar">
<fileset dir="${classes.dir}" includes="com/threerings/puzzle/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-micasa.jar">
<fileset dir="${classes.dir}" includes="com/threerings/micasa/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/micasa/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-stage.jar">
<fileset dir="${classes.dir}" includes="com/threerings/stage/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/stage/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-stats.jar">
<fileset dir="${classes.dir}" includes="com/threerings/stats/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/stats/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-whirled.jar">
<fileset dir="${classes.dir}" includes="com/threerings/whirled/**" excludes="**/*.png"/>
<fileset dir="${classes.dir}" includes="rsrc/**/whirled/**"/>
</jar>
</target>
<!-- a helper task for 'retro' -->
<target name="vweave">
<!-- various bits used by the retroweaver tasks -->
<taskdef name="weave" classpathref="classpath"
classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
<property name="inpre" value="${deploy.dir}/${lib.name}"/>
<property name="outpre" value="${deploy.dir}/retro/${lib.name}"/>
<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">
<mkdir dir="${deploy.dir}/retro"/>
<!-- we weave everything a first time without verification so that -->
<!-- interdependencies will resolve the second time -->
<weave inputjar="${inpre}-micasa.jar" outputjar="${outpre}-micasa.jar"/>
<weave inputjar="${inpre}-parlor.jar" outputjar="${outpre}-parlor.jar"/>
<weave inputjar="${inpre}-puzzle.jar" outputjar="${outpre}-puzzle.jar"/>
<weave inputjar="${inpre}-stage.jar" outputjar="${outpre}-stage.jar"/>
<weave inputjar="${inpre}-stats.jar" outputjar="${outpre}-stats.jar"/>
<weave inputjar="${inpre}-whirled.jar" outputjar="${outpre}-whirled.jar"/>
<!-- now weave again with the verifier to check for unweavable 1.5isms -->
<antcall target="vweave"><param name="which" value="micasa"/></antcall>
<antcall target="vweave"><param name="which" value="parlor"/></antcall>
<antcall target="vweave"><param name="which" value="puzzle"/></antcall>
<antcall target="vweave"><param name="which" value="stage"/></antcall>
<antcall target="vweave"><param name="which" value="stats"/></antcall>
<antcall target="vweave"><param name="which" value="whirled"/></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 tarball and zipfile for source distribution -->
<target name="distrib">
<echo message="You may want to stop and run 'ant savedoc' first."/>
<echo message="Building snapshot tar.gz distribution..."/>
<tar destfile="../vilya-snapshot.tar.gz" compression="gzip">
<tarfileset dir=".." mode="0664" dirmode="0775">
<include name="vilya/**"/>
<exclude name="**/.svn"/>
<exclude name="vilya/tests/dist/**"/>
<exclude name="vilya/dist/**"/>
<exclude name="vilya/code/**"/>
<exclude name="vilya/vilya-*.*"/>
</tarfileset>
</tar>
<echo message="Building snapshot zip distribution..."/>
<zip destfile="../vilya-snapshot.zip">
<fileset dir="..">
<include name="vilya/**"/>
<exclude name="**/.svn"/>
<exclude name="vilya/tests/dist/**"/>
<exclude name="vilya/dist/**"/>
<exclude name="vilya/code/**"/>
<exclude name="vilya/vilya-*.*"/>
</fileset>
</zip>
</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>