Build a Flash library like we build Java libraries. Tidied up some other bits

along the way.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@418 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2008-02-18 18:34:36 +00:00
parent 7e804e60c5
commit ffde63b3a5
5 changed files with 137 additions and 21 deletions
+51 -20
View File
@@ -6,7 +6,7 @@
<property file="build.properties"/>
<!-- configuration parameters -->
<property name="app.name" value="nenya"/>
<property name="lib.name" value="nenya"/>
<property name="deploy.dir" value="dist"/>
<property name="savedoc.dir" value="docs"/>
@@ -16,8 +16,8 @@
<!-- import some targets to enumerate library dependencies -->
<property name="libs.dir" value="lib"/>
<import file="libs-incl.xml"/>
<import file="depends-incl.xml"/>
<import file="etc/libs-incl.xml"/>
<import file="etc/depends-incl.xml"/>
<!-- declare our classpath business -->
<path id="classpath">
@@ -40,7 +40,7 @@
<fileset dir="rsrc" includes="**/*"/>
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset refid="${app.name}.libs"/>
<fileset refid="${lib.name}.libs"/>
</copy>
</target>
@@ -49,6 +49,7 @@
<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 -->
@@ -91,6 +92,36 @@
</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}.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_dir" 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}.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">
@@ -140,31 +171,31 @@
<target name="all" depends="clean,prepare,compile,ninstall,javadoc,tests,dist"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile,procstream,ninstall,tests">
<target name="dist" depends="prepare,compile,procstream,ninstall,aslib,tests">
<!-- build our various jar files -->
<jar destfile="${deploy.dir}/${app.name}-rsrc.jar">
<jar destfile="${deploy.dir}/${lib.name}-rsrc.jar">
<fileset dir="${classes.dir}" includes="com/threerings/resource/**"/>
</jar>
<jar destfile="${deploy.dir}/${app.name}-media.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/**"/>
<fileset dir="${classes.dir}" includes="com/threerings/NenyaLog*"/>
</jar>
<jar destfile="${deploy.dir}/${app.name}-miso.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}/${app.name}-cast.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}/${app.name}-jme.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}/${app.name}-openal.jar">
<jar destfile="${deploy.dir}/${lib.name}-openal.jar">
<fileset dir="${classes.dir}" includes="com/threerings/openal/**"/>
</jar>
</target>
@@ -174,8 +205,8 @@
<!-- various bits used by the retroweaver tasks -->
<taskdef name="weave" classpathref="classpath"
classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
<property name="inpre" value="${deploy.dir}/${app.name}"/>
<property name="outpre" value="${deploy.dir}/retro/${app.name}"/>
<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"/>
@@ -263,23 +294,23 @@
<!-- 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}/${app.name}-snapshot.zip"/>
<mkdir dir="${deploy.dir}/snapshot/${app.name}"/>
<copy todir="${deploy.dir}/snapshot/${app.name}">
<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="${app.name}-*.zip"/>
<exclude name="${lib.name}-*.zip"/>
</fileset>
</copy>
<copy todir="${deploy.dir}/snapshot/${app.name}/lib">
<copy todir="${deploy.dir}/snapshot/${lib.name}/lib">
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
</copy>
<copy todir="${deploy.dir}/snapshot/${app.name}/docs/api">
<copy todir="${deploy.dir}/snapshot/${lib.name}/docs/api">
<fileset dir="${deploy.dir}/docs" includes="**"/>
</copy>
<zip destfile="${deploy.dir}/${app.name}-snapshot.zip" basedir="${deploy.dir}/snapshot"/>
<zip destfile="${deploy.dir}/${lib.name}-snapshot.zip" basedir="${deploy.dir}/snapshot"/>
<delete dir="${deploy.dir}/snapshot"/>
</target>
+81
View File
@@ -0,0 +1,81 @@
<flex-config>
<compiler>
<accessible>false</accessible>
<show-actionscript-warnings>true</show-actionscript-warnings>
<debug>false</debug>
<external-library-path>
<path-element>@flex_sdk_dir@/frameworks/libs/playerglobal.swc</path-element>
<path-element>@flex_sdk_dir@/frameworks/libs</path-element>
<path-element>dist/lib</path-element>
</external-library-path>
<keep-generated-actionscript>false</keep-generated-actionscript>
<library-path>
</library-path>
<namespaces>
<namespace>
<uri>http://www.adobe.com/2006/mxml</uri>
<manifest>@flex_sdk_dir@/frameworks/mxml-manifest.xml</manifest>
</namespace>
</namespaces>
<optimize>false</optimize>
<show-binding-warnings>true</show-binding-warnings>
<show-deprecation-warnings>true</show-deprecation-warnings>
<strict>true</strict>
<as3>true</as3>
<es>false</es>
<verbose-stacktraces>true</verbose-stacktraces>
<fonts>
<max-cached-fonts>20</max-cached-fonts>
<max-glyphs-per-face>1000</max-glyphs-per-face>
<managers>
<manager-class>flash.fonts.JREFontManager</manager-class>
<manager-class>flash.fonts.BatikFontManager</manager-class>
</managers>
<local-fonts-snapshot>@flex_sdk_dir@/frameworks/localFonts.ser</local-fonts-snapshot>
</fonts>
<warn-array-tostring-changes>false</warn-array-tostring-changes>
<warn-assignment-within-conditional>true</warn-assignment-within-conditional>
<warn-bad-array-cast>true</warn-bad-array-cast>
<warn-bad-bool-assignment>true</warn-bad-bool-assignment>
<warn-bad-date-cast>true</warn-bad-date-cast>
<warn-bad-es3-type-method>true</warn-bad-es3-type-method>
<warn-bad-es3-type-prop>true</warn-bad-es3-type-prop>
<warn-bad-nan-comparison>true</warn-bad-nan-comparison>
<warn-bad-null-assignment>true</warn-bad-null-assignment>
<warn-bad-null-comparison>true</warn-bad-null-comparison>
<warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>
<warn-boolean-constructor-with-no-args>false</warn-boolean-constructor-with-no-args>
<warn-changes-in-resolve>false</warn-changes-in-resolve>
<warn-class-is-sealed>true</warn-class-is-sealed>
<warn-const-not-initialized>true</warn-const-not-initialized>
<warn-constructor-returns-value>true</warn-constructor-returns-value>
<warn-deprecated-event-handler-error>false</warn-deprecated-event-handler-error>
<warn-deprecated-function-error>false</warn-deprecated-function-error>
<warn-deprecated-property-error>false</warn-deprecated-property-error>
<warn-duplicate-argument-names>true</warn-duplicate-argument-names>
<warn-duplicate-variable-def>true</warn-duplicate-variable-def>
<warn-for-var-in-changes>false</warn-for-var-in-changes>
<warn-import-hides-class>true</warn-import-hides-class>
<warn-instance-of-changes>true</warn-instance-of-changes>
<warn-internal-error>true</warn-internal-error>
<warn-level-not-supported>false</warn-level-not-supported>
<warn-missing-namespace-decl>true</warn-missing-namespace-decl>
<warn-negative-uint-literal>true</warn-negative-uint-literal>
<warn-no-constructor>false</warn-no-constructor>
<warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>
<warn-no-type-decl>true</warn-no-type-decl>
<warn-number-from-string-changes>false</warn-number-from-string-changes>
<warn-scoping-change-in-this>false</warn-scoping-change-in-this>
<warn-slow-text-field-addition>true</warn-slow-text-field-addition>
<warn-unlikely-function-value>true</warn-unlikely-function-value>
<warn-xml-class-has-changed>false</warn-xml-class-has-changed>
</compiler>
<use-network>true</use-network>
<metadata>
<title>@lib_name@ library</title>
<description>http://www.threerings.net/code/@lib_name@/</description>
<publisher>Three Rings, Inc.</publisher>
<creator>Three Rings, Inc.</creator>
<language>EN</language>
</metadata>
</flex-config>
+4
View File
@@ -2,6 +2,7 @@
<!-- declares the libraries needed to build nenya -->
<project name="library-dependencies">
<fileset dir="${libs.dir}" id="nenya.libs">
<!-- Java dependencies -->
<include name="ant.jar"/>
<include name="commons-collections.jar"/>
<include name="commons-digester.jar"/>
@@ -25,5 +26,8 @@
<include name="jme.jar"/>
<include name="jme-bui.jar"/>
<include name="jl1.0.jar"/>
<!-- ActionScript dependencies -->
<include name="narya.swc"/>
<include name="flexlib.swc"/>
</fileset>
</project>
+1 -1
View File
@@ -13,7 +13,7 @@
<property name="tbundle.dir" value="rsrc/bundles/tiles"/>
<!-- import some targets to check dependency availability -->
<import file="../depends-incl.xml"/>
<import file="../etc/depends-incl.xml"/>
<!-- declare our classpath -->
<property name="classes.dir" value="${deploy.dir}/classes"/>