Files
nenya/build.xml
T
Michael Bayne e172d90672 Use new shipped Narya 1.11.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1190 ed5b42cb-e716-0410-a449-f6a68f950b19
2012-02-04 00:21:56 +00:00

278 lines
13 KiB
XML

<?xml version="1.0" standalone="yes"?>
<project name="nenya" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="deploy.dir" location="dist"/>
<property name="src.dir" location="src/main/java"/>
<property name="asrc.dir" location="src/main/as"/>
<property name="tsrc.dir" location="src/test/java"/>
<property name="classes.dir" location="${deploy.dir}/classes"/>
<property name="tclasses.dir" location="${deploy.dir}/test-classes"/>
<property name="ooo-build.vers" value="2.9"/>
<ant antfile="etc/bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
<target name="-prepare" depends="-init-ooo">
<mavendep pom="pom.xml"/>
<mavendep pom="etc/as-pom.xml" pathProp="aslib.path"/>
<mavendep pom="pom.xml" id="test" scope="test"/>
<mkdir dir="${deploy.dir}"/>
<path id="built.classpath">
<path refid="pom.xml.path"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.classpath">
<path refid="test.path"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="-prepare-as" depends="-prepare">
<maventaskdef groupId="com.threerings.ant" artifactId="actionscript" version="1.4"/>
<checkflex/> <!-- if flexsdk.dir is not already set, tries to infer it -->
<if><not><isset property="flexsdk.dir"/></not><then>
<echo>***</echo>
<echo>Not compiling Nenya ActionScript library. Set flexsdk.dir to enable.</echo>
<echo>***</echo>
</then></if>
</target>
<target name="-preptools" depends="-prepare">
<artifact:dependencies pathId="tools.classpath">
<dependency groupId="com.threerings" artifactId="narya-tools" version="1.11"/>
</artifact:dependencies>
<taskdef resource="com/threerings/presents/tools.properties" classpathref="tools.classpath"/>
</target>
<target name="clean" depends="-init-ooo" description="Deletes most build artifacts.">
<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>
<cleanmavendepcache pom="pom.xml"/>
<cleanmavendepcache pom="etc/as-pom.xml"/>
<cleanmavendepcache id="test"/>
</target>
<target name="distclean" description="Deletes all build artifacts.">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="-prepare" description="Compiles source files.">
<mkdir dir="${classes.dir}"/>
<ooojavac version="1.5" srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="pom.xml.path">
<exclude name="**/OggPlayer.java"/>
<exclude name="**/ModPlayer.java"/>
<exclude name="**/MidiPlayer.java"/>
<exclude name="**/Mp3Player.java"/>
</ooojavac>
<mkdir dir="${tclasses.dir}"/>
<ooojavac srcdir="${tsrc.dir}" destdir="${tclasses.dir}"
version="1.5" classpathref="test.classpath"/>
</target>
<target name="procstream" depends="-preptools"
description="Instruments Streamable classes for use in sandbox environments.">
<instream outdir="${classes.dir}">
<path refid="built.classpath"/>
<fileset dir="${classes.dir}" includes="**/data/*.class"/>
<fileset dir="${classes.dir}" includes="**/util/*.class"/>
</instream>
</target>
<target name="aslib" depends="-prepare-as" if="flexsdk.dir"
description="Builds ActionScript library.">
<compc srcdir="${asrc.dir}" libpath="${aslib.path}"
dest="${deploy.dir}/${ant.project.name}lib.swc"/>
</target>
<condition property="isunix"><os family="unix"/></condition>
<target name="-ninstall" depends="-prepare" if="isunix">
<exec os="Linux" dir="${src.dir}/com/threerings/util/keybd/Linux" executable="make">
<arg line="install"/>
</exec>
<echo level="info" message="Installing native libraries for ${os.name}..."/>
<exec dir="${src.dir}/com/threerings/util/unsafe/${os.name}" executable="make">
<arg line="install"/>
</exec>
</target>
<target name="javadoc" depends="-prepare" description="Builds javadocs.">
<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/nenya/docs/api"
additionalparam="-breakiterator" classpathref="built.classpath">
<link href="http://download.oracle.com/javase/6/docs/api/"/>
<link href="http://docs.guava-libraries.googlecode.com/git/javadoc/"/>
<link href="http://samskivert.googlecode.com/svn/apidocs"/>
<link href="http://threerings.googlecode.com/narya/apidocs"/>
<link href="http://www.jajakarta.org/ant/ant-1.6.1/docs/ja/manual/api/"/>
</javadoc>
</target>
<target name="asdoc" depends="-prepare" description="Builds ActionScript docs.">
<maventaskdef groupId="com.threerings.ant" artifactId="actionscript" version="1.4"/>
<mkdir dir="${deploy.dir}/asdocs"/>
<asdoc srcdir="${asrc.dir}" libpath="${aslib.path}" destdir="${deploy.dir}/asdocs"/>
</target>
<target name="-prep-test-rsrcs" depends="compile">
<copy todir="${tclasses.dir}">
<fileset dir="src/test/resources" includes="**"/>
</copy>
<property name="testrsrc.dir" value="${tclasses.dir}/rsrc"/>
</target>
<target name="test-colorpos" depends="-prep-test-rsrcs"
description="Builds the test colorpository data.">
<taskdef name="confcomp" classpathref="test.classpath"
classname="com.threerings.tools.CompiledConfigTask"/>
<confcomp parser="com.threerings.media.image.tools.xml.ColorPositoryParser"
configdef="${testrsrc.dir}/config/media/colordefs.xml"
target="${testrsrc.dir}/config/media/colordefs.dat"/>
</target>
<target name="test-tsbundles" depends="-prep-test-rsrcs"
description="Build test tileset bundles.">
<taskdef name="tilebundle" classpathref="test.classpath"
classname="com.threerings.media.tile.bundle.tools.TileSetBundlerTask"/>
<taskdef name="conffringe" classpathref="test.classpath"
classname="com.threerings.miso.tile.tools.CompileFringeConfigurationTask"/>
<property name="tbundle.dir" value="${testrsrc.dir}/bundles/tiles"/>
<!-- blow away the tilesetid map file so that we get a consistent mapping every time -->
<delete file="${tbundle.dir}/tilesets.map"/>
<tilebundle config="${tbundle.dir}/bundler-config.xml" mapfile="${tbundle.dir}/tilesets.map">
<fileset dir="${tbundle.dir}/ground" includes="**/*.xml"/>
</tilebundle>
<tilebundle config="${tbundle.dir}/bundler-config.xml" mapfile="${tbundle.dir}/tilesets.map">
<fileset dir="${tbundle.dir}/objects" includes="**/*.xml"/>
</tilebundle>
<conffringe tilesetmap="${tbundle.dir}/tilesets.map"
fringedef="${testrsrc.dir}/config/miso/tile/fringeconf.xml"
target="${testrsrc.dir}/config/miso/tile/fringeconf.dat"/>
</target>
<target name="test-cbundles" depends="-prep-test-rsrcs"
description="Builds test component bundles.">
<taskdef name="metabundle" classpathref="test.classpath"
classname="com.threerings.cast.bundle.tools.MetadataBundlerTask"/>
<taskdef name="cbundle" classpathref="test.classpath"
classname="com.threerings.cast.bundle.tools.ComponentBundlerTask"/>
<property name="cbundle.dir" value="${testrsrc.dir}/bundles/components"/>
<metabundle actiondef="${cbundle.dir}/actions.xml" classdef="${cbundle.dir}/classes.xml"
target="${cbundle.dir}/metadata.jar"/>
<!-- blow away the components map file so that we get a consistent mapping every time -->
<delete file="${cbundle.dir}/components.map"/>
<cbundle actiondef="${cbundle.dir}/actions.xml" target="${cbundle.dir}/pirate/components.jar"
mapfile="${cbundle.dir}/components.map" root="${cbundle.dir}/pirate">
<fileset dir="${cbundle.dir}/pirate" includes="**/*.png" excludes="components/**"/>
</cbundle>
<cbundle actiondef="${cbundle.dir}/actions.xml" target="${cbundle.dir}/vessel/components.jar"
mapfile="${cbundle.dir}/components.map" root="${cbundle.dir}/vessel">
<fileset dir="${cbundle.dir}/vessel" includes="**/*.png" excludes="components/**"/>
</cbundle>
</target>
<property name="test" value=""/>
<target name="test-units" 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}"/>
<sysproperty key="resource_dir" value="${testrsrc.dir}"/>
<sysproperty key="no_unpack_resources" value="true"/>
<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="tests" depends="dist,test-colorpos,test-tsbundles,test-cbundles,test-units"
description="Runs all tests."/>
<target name="all" depends="clean,-prepare,compile,-ninstall,tests,javadoc,dist,aslib"
description="Cleans and rebuilds everything, including javadocs."/>
<target name="dist" depends="-prepare,compile,procstream,-ninstall"
description="Compiles everything and builds distribution jar files.">
<jar destfile="${deploy.dir}/${ant.project.name}.jar" basedir="${classes.dir}"/>
<!-- also build our various split jar files -->
<jar destfile="${deploy.dir}/${ant.project.name}-rsrc.jar">
<fileset dir="${classes.dir}" includes="com/threerings/resource/**"/>
</jar>
<jar destfile="${deploy.dir}/${ant.project.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}/${ant.project.name}-miso.jar">
<fileset dir="${classes.dir}" includes="com/threerings/miso/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/miso/**"/>
</jar>
<jar destfile="${deploy.dir}/${ant.project.name}-cast.jar">
<fileset dir="${classes.dir}" includes="com/threerings/cast/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**/cast/**"/>
</jar>
<jar destfile="${deploy.dir}/${ant.project.name}-chat.jar">
<fileset dir="${classes.dir}" includes="com/threerings/chat/**"/>
</jar>
<jar destfile="${deploy.dir}/${ant.project.name}-openal.jar">
<fileset dir="${classes.dir}" includes="com/threerings/openal/**"/>
</jar>
</target>
<target name="genascript" depends="-preptools"
description="Generates ActionScript versions of our Streamable classes.">
<genascript header="lib/SOURCE_HEADER" asroot="${asrc.dir}">
<fileset dir="${src.dir}" includes="**/data/*.java"/>
</genascript>
</target>
<property name="scene" value="idyll"/>
<target name="miso-viewer" depends="compile,test-colorpos,test-tsbundles,test-cbundles"
description="Runs the Miso scene viewer.">
<java classname="com.threerings.miso.viewer.ViewerApp"
fork="true" classpathref="test.classpath">
<sysproperty key="resource_dir" value="${testrsrc.dir}"/>
<sysproperty key="no_unpack_resources" value="true"/>
<arg value="${testrsrc.dir}/scenes/${scene}.xml"/>
</java>
</target>
<target name="-as-install" depends="aslib" if="flexsdk.dir">
<maveninstall file="${deploy.dir}/${ant.project.name}lib.swc" pom="etc/as-pom.xml"/>
</target>
<target name="install" depends="dist,-as-install"
description="Deploys build artifacts to local Maven repository.">
<maveninstall file="${deploy.dir}/${ant.project.name}.jar" pom="pom.xml"/>
<maveninstall file="${deploy.dir}/${ant.project.name}.jar" pom="etc/tools-pom.xml"/>
</target>
<target name="-as-deploy" depends="aslib" if="flexsdk.dir">
<mavendeploy file="${deploy.dir}/${ant.project.name}lib.swc" pom="etc/as-pom.xml"/>
</target>
<target name="deploy" depends="dist,-as-deploy,tests,javadoc"
description="Deploys our build artifacts to a Maven repository.">
<mavendeploy file="${deploy.dir}/${ant.project.name}.jar" pom="pom.xml"
srcdir="${src.dir}" docdir="${deploy.dir}/docs"/>
<mavendeploy file="${deploy.dir}/${ant.project.name}.jar" pom="etc/tools-pom.xml"/>
</target>
</project>