Modified Nenya to use ooo-build scripts, chiefly for my own edification.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1126 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -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>
|
||||
@@ -1,40 +1,27 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<project name="nenya" 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="asrc.dir" value="src/main/as"/>
|
||||
<property name="tsrc.dir" value="src/test/java"/>
|
||||
<property name="deploy.dir" value="dist"/>
|
||||
<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"/>
|
||||
<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="pom.xml.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>
|
||||
@@ -56,6 +43,9 @@
|
||||
<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.">
|
||||
@@ -64,26 +54,20 @@
|
||||
|
||||
<target name="compile" depends="-prepare" description="Compiles source files.">
|
||||
<mkdir dir="${classes.dir}"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<compilerarg value="-Xlint:-serial"/>
|
||||
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
|
||||
</javac>
|
||||
</ooojavac>
|
||||
|
||||
<mkdir dir="${tclasses.dir}"/>
|
||||
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
|
||||
debug="on" optimize="off" deprecation="off">
|
||||
<classpath refid="test.classpath"/>
|
||||
<ooojavac srcdir="${tsrc.dir}" destdir="${tclasses.dir}"
|
||||
version="1.5" classpathref="test.classpath"/>
|
||||
<!--
|
||||
<exclude name="com/threerings/openal/**" unless="build.openal"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<compilerarg value="-Xlint:-serial"/>
|
||||
</javac>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<target name="procstream" depends="-preptools"
|
||||
@@ -95,48 +79,10 @@
|
||||
</instream>
|
||||
</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="aslib" unless="no_rebuild_aslib" depends="-checkaslib,-noteaslib"
|
||||
description="Builds ActionScript library.">
|
||||
<!-- 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>
|
||||
|
||||
<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 ActionScript library.">
|
||||
<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>
|
||||
|
||||
<condition property="isunix"><os family="unix"/></condition>
|
||||
@@ -150,40 +96,24 @@
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- build the javadoc documentation -->
|
||||
<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"
|
||||
additionalparam="-breakiterator"
|
||||
link="http://www.threerings.net/code/nenya/docs/api">
|
||||
<classpath refid="compile.classpath"/>
|
||||
link="http://www.threerings.net/code/nenya/docs/api"
|
||||
additionalparam="-breakiterator" classpathref="built.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://samskivert.googlecode.com/svn/apidocs"/>
|
||||
<link href="http://www.threerings.net/code/narya/docs/api"/>
|
||||
<link href="http://www.jmonkeyengine.com/doc"/>
|
||||
</javadoc>
|
||||
<copy todir="${deploy.dir}/docs">
|
||||
<fileset dir="${src.dir}" includes="**/*.png"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- builds the ActionScript documention -->
|
||||
<target name="asdoc" unless="no_build_aslib" depends="-checkaslib">
|
||||
<target name="asdoc" depends="-prepare" description="Builds ActionScript docs.">
|
||||
<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 ${deploy.dir}/lib"/>
|
||||
<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>
|
||||
|
||||
<target name="-prep-test-rsrcs" depends="-prepare">
|
||||
@@ -327,21 +257,8 @@
|
||||
<property name="maven.deploy.repo" value="file://${user.home}/.m2/repository"/>
|
||||
<target name="maven-deploy" depends="dist,tests"
|
||||
description="Deploys our build artifacts to a Maven repository.">
|
||||
<jar basedir="${src.dir}" destfile="${deploy.dir}/${ant.project.name}-sources.jar"/>
|
||||
<artifact:deploy file="${deploy.dir}/${ant.project.name}.jar" uniqueVersion="false">
|
||||
<remoteRepository url="${maven.deploy.repo}"/>
|
||||
<pom refid="pom"/>
|
||||
<attach file="${deploy.dir}/${ant.project.name}-sources.jar" classifier="sources"/>
|
||||
</artifact:deploy>
|
||||
<artifact:pom id="tools-pom" file="etc/tools-pom.xml"/>
|
||||
<artifact:deploy file="${deploy.dir}/${ant.project.name}.jar" uniqueVersion="false">
|
||||
<remoteRepository url="${maven.deploy.repo}"/>
|
||||
<pom refid="tools-pom"/>
|
||||
</artifact:deploy>
|
||||
<artifact:pom id="as-pom" file="etc/as-pom.xml"/>
|
||||
<artifact:deploy file="${deploy.dir}/${ant.project.name}lib.swc" uniqueVersion="false">
|
||||
<remoteRepository url="${maven.deploy.repo}"/>
|
||||
<pom refid="as-pom"/>
|
||||
</artifact:deploy>
|
||||
<mavendeploy file="${deploy.dir}/${ant.project.name}.jar" srcdir="${src.dir}" pom="pom.xml"/>
|
||||
<mavendeploy file="${deploy.dir}/${ant.project.name}.jar" pom="etc/tools-pom.xml"/>
|
||||
<mavendeploy file="${deploy.dir}/${ant.project.name}lib.swc" pom="etc/as-pom.xml"/>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user