Files
nenya/build.xml
T
Michael Bayne 04f4488f55 Make the "tests" target actually work (and run the tests). But we'll not run
the tests on every "dist" build, we'll just stick with the current behavior of
only compiling the tests (to make sure they don't rot). In a better world
ooo-libs would have a testall target which runs the tests on all the projects
it builds, so that we actually got the benefit of the few unit tests we have.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@909 ed5b42cb-e716-0410-a449-f6a68f950b19
2010-04-05 01:35:58 +00:00

337 lines
14 KiB
XML

<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="nenya" default="compile" basedir=".">
<!-- import overriding properties -->
<property file="build.properties"/>
<!-- configuration parameters -->
<property name="lib.name" value="nenya"/>
<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>
<!-- 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="**/*"/>
</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/jme/**" unless="build.jme"/>
<exclude name="com/threerings/openal/**" unless="build.openal"/>
<exclude name="com/threerings/**/tools/xml/**" unless="build.xml"/>
<exclude name="**/OggPlayer.java"/>
<exclude name="**/ModPlayer.java"/>
<exclude name="**/MidiPlayer.java"/>
<exclude name="**/Mp3Player.java"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
</javac>
</target>
<!-- adds readField and writeField methods to Stremable classes -->
<target name="procstream" depends="prepare">
<taskdef resource="com/threerings/presents/tools.properties"
classpath="${deploy.dir}/lib/narya-tools.jar"/>
<instream outdir="${classes.dir}">
<path refid="classpath"/>
<fileset dir="${classes.dir}" includes="**/data/*.class"/>
<fileset dir="${classes.dir}" includes="**/util/*.class"/>
</instream>
</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>
<!-- installs the pre-built native libraries -->
<condition property="isunix"><os family="unix"/></condition>
<target name="ninstall" depends="prepare" if="isunix">
<exec os="Linux" dir="src/java/com/threerings/util/keybd/Linux" executable="make">
<arg line="install"/>
</exec>
<echo level="info" message="Installing native libraries for ${os.name}..."/>
<exec dir="src/java/com/threerings/util/unsafe/${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/nenya/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.jmonkeyengine.com/doc"/>
</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"/>
<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="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-doc-sources src/as"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
</target>
<target name="tcompile" description="Builds (but does not run) the tests.">
<ant dir="tests" target="compile" inheritAll="false"/>
</target>
<target name="tests" description="Builds and runs the tests.">
<ant dir="tests" target="tests" inheritAll="false"/>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,prepare,compile,ninstall,tests,javadoc,dist"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile,tcompile,procstream,ninstall,aslib">
<!-- build our various jar files -->
<jar destfile="${deploy.dir}/${lib.name}-rsrc.jar">
<fileset dir="${classes.dir}" includes="com/threerings/resource/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-media.jar">
<fileset dir="${classes.dir}" includes="com/threerings/geom/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/media/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/tools/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/util/**"
excludes="**/*.c,**/Makefile,**/*.h"/>
<fileset dir="${classes.dir}" includes="com/threerings/NenyaLog*"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-miso.jar">
<fileset dir="${classes.dir}" includes="com/threerings/miso/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/miso/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-cast.jar">
<fileset dir="${classes.dir}" includes="com/threerings/cast/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/cast/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-jme.jar">
<fileset dir="${classes.dir}" includes="com/threerings/jme/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/jme/**"/>
</jar>
<jar destfile="${deploy.dir}/${lib.name}-openal.jar">
<fileset dir="${classes.dir}" includes="com/threerings/openal/**"/>
</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}-cast.jar" outputjar="${outpre}-cast.jar"/>
<weave inputjar="${inpre}-micasa.jar" outputjar="${outpre}-micasa.jar"/>
<weave inputjar="${inpre}-miso.jar" outputjar="${outpre}-miso.jar"/>
<weave inputjar="${inpre}-media.jar" outputjar="${outpre}-media.jar"/>
<weave inputjar="${inpre}-rsrc.jar" outputjar="${outpre}-rsrc.jar"/>
<!-- now weave again with the verifier to check for unweavable 1.5isms -->
<antcall target="vweave"><param name="which" value="cast"/></antcall>
<antcall target="vweave"><param name="which" value="micasa"/></antcall>
<antcall target="vweave"><param name="which" value="miso"/></antcall>
<antcall target="vweave"><param name="which" value="media"/></antcall>
<antcall target="vweave"><param name="which" value="rsrc"/></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 tar.gz distribution..."/>
<tar destfile="../nenya-snapshot.tar.gz" compression="gzip">
<tarfileset dir=".." mode="0775" dirmode="0775">
<include name="nenya/bin/**"/>
<include name="nenya/tests/bin/**"/>
<exclude name="**/.svn"/>
</tarfileset>
<tarfileset dir=".." mode="0664" dirmode="0775">
<include name="nenya/**"/>
<exclude name="**/.svn"/>
<exclude name="nenya/tests/dist/**"/>
<exclude name="nenya/dist/**"/>
<exclude name="nenya/code/**"/>
<exclude name="nenya/nenya-*.*"/>
</tarfileset>
</tar>
<echo message="Building zip distribution..."/>
<zip destfile="../nenya-snapshot.zip">
<fileset dir="..">
<include name="nenya/**"/>
<exclude name="**/.svn"/>
<exclude name="nenya/tests/dist/**"/>
<exclude name="nenya/dist/**"/>
<exclude name="nenya/code/**"/>
<exclude name="nenya/nenya-*.*"/>
</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>