Changed BureauRegistry to use Launcher and updated bureau tests

* Moved the thane-specific TestClientMain out into src/thane and renamed 
  BureauTestClient
* Removed server name and port from the registry init and from the Launcher/
  CommandGenerator parameters. These can be inserted by the caller
* Converted all the asc junk to compc/mxmlc the same as msoy does it
* Moved the test client main function into src/as land
* Added extdeps.suffix alternative approach since tests/build.xml does not
  get launched from nifty ooo-libs container
* Fixed bureau test targets
* Moved avmthane to overridable property and corrected out of date default
* Converted BureauRegistry code to deal with Launcher objects and added shim
  to preserve use of CommandGenerator
* Fixed narya build to remove thane-config.xml after building aslib


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5218 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-07-02 23:44:11 +00:00
parent ffeb20b2c7
commit 8ce8e69b59
10 changed files with 601 additions and 148 deletions
+99 -47
View File
@@ -1,6 +1,9 @@
<!-- build configuration -->
<project name="narya tests" default="compile" basedir=".">
<!-- import overriding properties -->
<property file="../build.properties"/>
<!-- things you may want to change -->
<property name="junit.fork" value="true"/>
@@ -8,10 +11,14 @@
<property name="test.dir" value="."/>
<property name="src.dir" value="src/java"/>
<property name="deploy.dir" value="dist"/>
<property name="lib.name" value="naryatests"/>
<property name="cbundle.dir" value="rsrc/bundles/components"/>
<property name="tbundle.dir" value="rsrc/bundles/tiles"/>
<!-- this may be changed if you don't have msoy built -->
<property name="avmthane" value="/export/msoy/dist/lib/avmthane"/>
<!-- declare our classpath -->
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="narya.classes.dir" value="../${deploy.dir}/classes"/>
@@ -99,36 +106,63 @@
</javac>
</target>
<!-- checks whether the abc library needs to be compiled -->
<target name="check-abclib">
<condition property="abclib_up_to_date">
<uptodate targetfile="${deploy.dir}/testslib.abc">
<srcfiles dir="../lib" includes="*.abc"/>
<srcfiles dir="../dist" includes="*.abc"/>
<srcfiles dir="src/as" includes="**/*.as"/>
</uptodate>
</condition>
<!-- 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}.swc">
<srcfiles dir="src/as" includes="**/*.as"/>
<srcfiles dir="../dist" includes="*.swc"/>
</uptodate>
<uptodate targetfile="${deploy.dir}/${lib.name}.abc">
<srcfiles dir="src/as" includes="**/*.as"/>
<srcfiles dir="../dist" includes="*.swc"/>
</uptodate>
</and>
</or></condition>
<available property="extdep.suffix" value="-0.0-SNAPSHOT"
filepath="../dist/lib" file="thane-0.0-SNAPSHOT.swc"/>
</target>
<!-- builds our Flash (abc) library -->
<target name="abclib" unless="abclib_up_to_date" depends="check-abclib,prepare"
description="Build the abc library for tests classes">
<taskdef name="asc" classname="flex.ant.AscTask" classpathref="classpath"/>
<asc as3="true" strict="true" classpathref="classpath" use="AS3">
<import dir="../dist">
<include name="builtin.abc"/>
<include name="thane.abc"/>
<include name="narya-abc.abc"/>
</import>
<in dir="src/as">
<include name="**/*.as"/>
<exclude name="**/*Main.as"/>
</in>
<filespec dir="../etc" includes="empty.as"/>
</asc>
<move overwrite="true" file="../etc/empty.abc" tofile="${deploy.dir}/testslib.abc"/>
<!-- builds our Flash library -->
<target name="aslib" unless="no_build_aslib" depends="checkaslib">
<!-- Generate aslib-config.xml for Flash Player and general compilation -->
<copy file="etc/thane-config.xml.in" tofile="${deploy.dir}/thane-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
<filter token="lib_name" value="${lib.name}"/>
</filterset>
</copy>
<!-- Build Narya tests -->
<java jar="${flexsdk.dir}/lib/compc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="${deploy.dir}/thane-config.xml"/>
<arg value="-compiler.optimize"/>
<arg value="-compiler.source-path=src/as/"/>
<arg value="-compiler.external-library-path"/>
<arg value="../dist/lib/thane${extdep.suffix}.swc"/>
<arg value="-compiler.library-path"/>
<arg value="../dist/thane-env.swc"/>
<arg value="../dist/naryalib.swc"/>
<arg value="-output"/>
<arg value="${deploy.dir}/${lib.name}.swc"/>
<arg value="-compiler.source-path"/>
<arg value="src/as/"/>
<arg value="-include-sources=src/as/com/threerings/bureau/client/TestClient.as"/>
</java>
<delete file="${deploy.dir}/aslib-config.xml"/>
<echo message="Turning .swc into .abc..."/>
<java outputproperty="dump" classpathref="classpath"
classname="flash.swf.tools.SwfxPrinter" fork="true" failonerror="true">
<arg value="-dump"/>
<arg value="${deploy.dir}/${lib.name}.abc"/>
<arg value="${deploy.dir}/${lib.name}.swc"/>
</java>
</target>
<!-- run the tests -->
<target name="test" depends="compile"
description="Run the tests.">
@@ -147,29 +181,48 @@
<!-- checks whether the bureau client needs to be compiled -->
<target name="bureau-check-thane-client">
<condition property="thane_client_up_to_date">
<uptodate targetfile="${deploy.dir}/TestClientMain.abc">
<srcfiles dir="dist" includes="testslib.abc"/>
<condition property="no_build_thane_client">
<uptodate targetfile="${deploy.dir}/BureauTestClient.abc">
<srcfiles dir="dist" includes="*.swc"/>
<srcfiles dir="src/thane" includes="**/*.as"/>
</uptodate>
</condition>
</target>
<!-- builds the bureau thane test client -->
<target name="bureau-compile-thane-client"
unless="thane_client_up_to_date" depends="abclib,bureau-check-thane-client"
description="Compiles the thane client for testing the bureau library">
<taskdef name="asc" classname="flex.ant.AscTask" classpathref="classpath"/>
<asc as3="true" strict="true" classpathref="classpath" use="AS3">
<import dir="..">
<include name="dist/builtin.abc"/>
<include name="dist/thane.abc"/>
<include name="dist/narya-abc.abc"/>
<include name="tests/dist/testslib.abc"/>
</import>
<filespec dir="src/as" includes="com/threerings/bureau/client/TestClientMain.as"/>
</asc>
<move overwrite="true" todir="dist"
file="src/as/com/threerings/bureau/client/TestClientMain.abc"/>
unless="no_build_thane_client" depends="aslib,bureau-check-thane-client"
description="Compiles the thane client for testing the bureau library">
<dirname property="abs.flexsdk.dir" file="${flexsdk.dir}/somefile.txt"/>
<copy file="etc/thane-config.xml.in" tofile="${deploy.dir}/thane-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${abs.flexsdk.dir}"/>
</filterset>
</copy>
<!-- link the executable -->
<java jar="${flexsdk.dir}/lib/mxmlc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="${deploy.dir}/thane-config.xml"/>
<arg value="-compiler.external-library-path"/>
<arg value="../dist/lib/thane${extdep.suffix}.swc"/>
<arg value="dist/${lib.name}.swc"/>
<arg value="-compiler.source-path=src/thane"/>
<arg value="-output"/>
<arg value="${deploy.dir}/BureauTestClient.swf"/>
<arg value="src/thane/BureauTestClient.as"/>
</java>
<delete file="${deploy.dir}/thane-config.xml"/>
<echo message="Turning .swf into .abc..."/>
<java outputproperty="dump" classpathref="classpath"
classname="flash.swf.tools.SwfxPrinter" fork="true" failonerror="true">
<arg value="-dump"/>
<arg value="${deploy.dir}/BureauTestClient.abc"/>
<arg value="${deploy.dir}/BureauTestClient.swf"/>
</java>
</target>
<target name="bureau-runserver" depends="compile"
@@ -210,11 +263,10 @@
<!-- runs the thane test client -->
<target name="bureau-run-thane-client" depends="bureau-compile-thane-client"
description="Runs the thane client for testing the bureau library">
<exec executable="/export/thane/tamarin-central/dist/thane/avmthane">
<exec executable="${avmthane}">
<!--arg value="-Dverbose"/-->
<arg value="../dist/narya-abc.abc"/>
<arg value="dist/testslib.abc"/>
<arg value="dist/TestClientMain.abc"/>
<arg value="dist/naryatests.abc"/>
<arg value="dist/BureauTestClient.abc"/>
<arg value="--"/>
<arg value="${token}"/>
<arg value="${bureauId}"/>