Converted to ooo-build.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@1059 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2011-03-16 18:18:18 +00:00
parent a94a8dcf41
commit 5d54ff0d60
2 changed files with 77 additions and 122 deletions
+36
View File
@@ -0,0 +1,36 @@
<project name="bootstrap" default="-extract-ooo-build">
<!--
Pulls in ooo-build from our maven repository to make our base build system available.
From http://ooo-build.googlecode.com/hg/etc/bootstrap.xml
To use, copy this file into your project's directory and add
<property name="ooo-build.vers" value="2.1"/>
<ant antfile="bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
to the top level of your build.xml. Then you can depend on -init-ooo in your lowest level
target to expose ooo-build's maven macros, javac macros, and antcontrib.
-->
<property name="maven.dir" value="${user.home}/.m2"/>
<property name="ooo-build.path"
value="com/threerings/ooo-build/${ooo-build.vers}"/>
<property name="ooo-build.jar"
value="ooo-build-${ooo-build.vers}.jar"/>
<property name="ooo-build.local.dir" value="${maven.dir}/repository/${ooo-build.path}"/>
<property name="ooo-build.local.file" value="${ooo-build.local.dir}/${ooo-build.jar}"/>
<condition property="ooo-build.exists"><available file="${ooo-build.local.file}"/></condition>
<target name="-download-ooo-build" unless="ooo-build.exists">
<mkdir dir="${ooo-build.local.dir}"/>
<get src="http://ooo-maven.googlecode.com/hg/repository/${ooo-build.path}/${ooo-build.jar}"
dest="${ooo-build.local.file}" usetimestamp="true"/>
</target>
<property name="ooo-build.dir" value="${maven.dir}/ooo-build/${ooo-build.vers}"/>
<condition property="extracted.exists"><available file="${ooo-build.dir}/ooo-build.xml"/></condition>
<target name="-extract-ooo-build" depends="-download-ooo-build" unless="extracted.exists">
<mkdir dir="${ooo-build.dir}"/>
<unjar src="${ooo-build.local.file}" dest="${ooo-build.dir}"/>
</target>
</project>
+41 -122
View File
@@ -1,41 +1,27 @@
<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="vilya" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="deploy.dir" value="dist"/>
<property name="src.dir" value="src/main/java"/>
<property name="tsrc.dir" value="src/test/java"/>
<property name="asrc.dir" value="src/main/as"/>
<property name="tsrc.dir" value="src/test/java"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<property name="maven-ant.vers" value="2.1.1"/>
<property name="maven-ant.dir" value="${user.home}/.m2/ant-support"/>
<property name="maven-ant.jar" value="${maven-ant.dir}/maven-ant-tasks-${maven-ant.vers}.jar"/>
<property name="maven-ant.url"
value="http://mirrors.ibiblio.org/pub/mirrors/apache/maven/binaries"/>
<condition property="maven-ant.exists"><available file="${maven-ant.jar}"/></condition>
<target name="-download-maven-ant" unless="maven-ant.exists">
<mkdir dir="${maven-ant.dir}"/>
<get src="${maven-ant.url}/maven-ant-tasks-${maven-ant.vers}.jar"
dest="${maven-ant.jar}" usetimestamp="true"/>
</target>
<property name="ooo-build.vers" value="2.1"/>
<ant antfile="bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
<target name="-init-maven-ant" depends="-download-maven-ant">
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="${maven-ant.jar}"/>
<artifact:pom id="pom" file="pom.xml"/>
<artifact:dependencies pathId="compile.classpath" pomRefId="pom" useScope="compile"/>
<artifact:dependencies pathId="testlibs.classpath" pomRefId="pom" useScope="test"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<target name="-prepare" depends="-init-ooo">
<mavendep pom="pom.xml" id="compile"/>
<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="compile.classpath"/>
<path refid="compile.path"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.classpath">
<path refid="testlibs.classpath"/>
<path refid="test.path"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
@@ -49,10 +35,14 @@
</target>
<target name="clean" description="Cleans out build results">
<delete dir="${deploy.dir}/classes"/>
<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="Scorched earth clean">
@@ -62,81 +52,27 @@
<target name="compile" depends="-prepare" description="Builds the Java code.">
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}"><fileset dir="src/main/resources" includes="**"/></copy>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on" source="1.5" target="1.5">
<classpath refid="compile.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
</javac>
<ooojavac version="1.5" srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="compile.path"/>
<mkdir dir="${tclasses.dir}"/>
<copy todir="${tclasses.dir}"><fileset dir="src/test/resources" includes="**"/></copy>
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" source="1.5" target="1.5"
encoding="utf-8" classpathref="test.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<ooojavac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" version="1.5"
classpathref="test.classpath"/>
</target>
<target name="-checkaslib">
<condition property="no_build_aslib">
<not><available file="${flexsdk.dir}/lib/compc.jar"/></not>
</condition>
<condition property="no_rebuild_aslib"><or>
<isset property="no_build_aslib"/>
<uptodate targetfile="${deploy.dir}/${ant.project.name}lib.swc">
<srcfiles dir="${asrc.dir}" includes="**/*.as"/>
</uptodate>
</or></condition>
</target>
<target name="-noteaslib" if="no_build_aslib"><echo>
NOTE: not building ActionScript library. Pass -Dflexsdk.dir=DIR to
activate ActionScript library build.
</echo></target>
<target name="-asprepare" depends="-checkaslib">
<!-- obtain our ActionScript dependencies via Maven -->
<artifact:pom id="as-pom" file="etc/as-pom.xml"/>
<artifact:dependencies filesetId="aslibs.fileset" pomRefId="as-pom" useScope="compile"/>
<copy todir="${deploy.dir}/lib">
<fileset refid="aslibs.fileset"/>
<mapper type="flatten"/>
</copy>
<target name="procstream" depends="-preptools"
description="Adds readField and writeField methods to Streamable classes">
<!-- now instrument the associated files -->
<instream outdir="${classes.dir}">
<path refid="built.classpath"/>
<fileset dir="${classes.dir}" includes="**/*.class"/>
</instream>
</target>
<target name="aslib" unless="no_rebuild_aslib" depends="-asprepare,-noteaslib"
description="Builds the ActionScript code">
<!-- TODO: these don't seem to be needed for the ActionScript library
build, why are/where they here -->
<property name="libs.dir" value="lib"/>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset dir="${libs.dir}">
<!-- Thane dependencies -->
<include name="thane-0.0-SNAPSHOT.abc"/>
<include name="tamarin-builtin.abc"/>
<include name="narya-abc.abc"/>
</fileset>
</copy>
<!-- END TODO -->
<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="${ant.project.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=${asrc.dir}/"/>
<arg value="-include-sources=${asrc.dir}/"/>
<arg value="-output"/>
<arg value="${deploy.dir}/${ant.project.name}lib.swc"/>
</java>
<delete file="${deploy.dir}/aslib-config.xml"/>
<target name="aslib" depends="-prepare" description="Builds the ActionScript code">
<maventaskdef groupId="com.threerings.ant" artifactId="actionscript" version="1.0"/>
<compc srcdir="${asrc.dir}" libpath="${aslib.path}"
dest="${deploy.dir}/${ant.project.name}lib.swc"/>
</target>
<target name="javadoc" depends="-prepare" description="Builds the Java documentation">
@@ -145,29 +81,21 @@
destdir="${deploy.dir}/docs" stylesheetfile="docs/stylesheet.css"
additionalparam="-breakiterator"
link="http://www.threerings.net/code/vilya/docs/api">
<classpath refid="compile.classpath"/>
<classpath refid="built.classpath"/>
<link href="http://java.sun.com/j2se/1.5/docs/api/"/>
<link href="http://samskivert.googlecode.com/svn/apidocs"/>
<link href="http://www.threerings.net/code/narya/docs/api"/>
</javadoc>
<copy todir="${deploy.dir}/docs">
<fileset dir="${src.dir}" includes="**/*.png"/>
</copy>
</target>
<target name="asdoc" unless="no_build_aslib" depends="-asprepare"
<target name="asdoc" unless="no_build_aslib" depends="-prepare"
description="Builds the ActionScript documention">
<maventaskdef groupId="com.threerings.ant" artifactId="actionscript" version="1.0"/>
<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 ${com.threerings:naryalib:swc}"/>
<arg line="-library-path ${com.threerings:nenyalib:swc}"/>
<arg line="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-doc-sources ${asrc.dir}"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
<asdoc srcdir="${asrc.dir}" libpath="${aslib.path}" destdir="${deploy.dir}/asdocs"/>
</target>
<property name="test" value=""/>
@@ -219,11 +147,11 @@
<target name="genrecord" depends="-prepare"
description="Generates fields for persistent record classes.">
<taskdef name="grecord" classname="com.samskivert.depot.tools.GenRecordTask"
classpathref="compile.classpath"/>
classpathref="compile.path"/>
<!-- make sure the record class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on">
<classpath refid="compile.classpath"/>
<classpath refid="built.classpath"/>
<include name="**/*Record.java"/>
</javac>
<!-- now update the source files -->
@@ -237,7 +165,7 @@
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5" classpathref="compile.classpath">
source="1.5" target="1.5" classpathref="built.classpath">
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
@@ -252,7 +180,7 @@
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5">
<classpath refid="compile.classpath"/>
<classpath refid="built.classpath"/>
<include name="**/*Service.java"/>
<exclude name="**/InvocationService.java"/>
</javac>
@@ -283,7 +211,7 @@
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5">
<classpath refid="compile.classpath"/>
<classpath refid="built.classpath"/>
<include name="**/*Receiver.java"/>
<exclude name="**/InvocationReceiver.java"/>
</javac>
@@ -294,15 +222,6 @@
</genreceiver>
</target>
<target name="procstream" depends="-preptools"
description="Adds readField and writeField methods to Streamable classes">
<!-- now instrument the associated files -->
<instream outdir="${classes.dir}">
<path refid="built.classpath"/>
<fileset dir="${classes.dir}" includes="**/*.class"/>
</instream>
</target>
<target name="genascript" depends="-preptools"
description="Generates ActionScript versions of our Streamable classes">
<!-- now generate the associated files -->