Switched (partially) to Maven-based dependency resolution. Further work

forthcoming to fix up the tests.

Peskily, it looks like I'm going to have to take one for the team and become
the maintainer of a Maven artifact for LWJGL. In spite of repeated requests
over the years for Mavenized artifacts for LWJGL, Mazon resists it (he seems to
think he has to use Maven to *build* LWJGL, which he certainly need not do).
There have been a variety of half-assed attempts to maintain third-party Maven
repositories, all of which have petered out a major version or two ago.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1045 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2010-11-08 18:51:32 +00:00
parent f1a2fe5e81
commit 63a26726d1
32 changed files with 327 additions and 192 deletions
+116 -70
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="nenya" default="compile" basedir=".">
<project name="nenya" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="lib.name" value="nenya"/>
<property name="src.dir" value="src/main/java"/>
<property name="tsrc.dir" value="src/test/java"/>
@@ -8,38 +7,99 @@
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<!-- import some targets to enumerate library dependencies -->
<!-- TEMP: this can go away when all of our depends come from Maven -->
<property name="libs.dir" value="lib"/>
<import file="etc/libs-incl.xml"/>
<import file="etc/depends-incl.xml"/>
<fileset dir="${libs.dir}" id="nenya.libs">
<!-- these LWJGL (for OpenAL) and codec libraries are optional -->
<include name="lwjgl.jar"/>
<include name="lwjgl_util.jar"/>
<include name="jogg-0.0.7.jar"/>
<include name="jorbis-0.0.15.jar"/>
<include name="jl1.0.jar"/>
<!-- ActionScript dependencies -->
<include name="as3isolib-fp9.swc"/>
<include name="aspirin.swc"/>
<include name="flexlib.swc"/>
<include name="naryalib.swc"/>
</fileset>
<!-- end TEMP -->
<!-- declare our classpath business -->
<path id="classpath">
<pathelement location="${classes.dir}"/>
<fileset dir="${deploy.dir}/lib" includes="**/*.jar"/>
</path>
<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>
<!-- prepares the application directories -->
<target name="prepare">
<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="complibs.classpath" pomRefId="pom" useScope="compile"/>
<artifact:dependencies pathId="testlibs.classpath" pomRefId="pom" useScope="test"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${deploy.dir}"/>
<!-- TEMP: this can go away when all of our depends come from Maven -->
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${classes.dir}/rsrc"/>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" includes="**/*.properties"/>
<fileset dir="${src.dir}" includes="**/*.tmpl"/>
</copy>
<copy todir="${classes.dir}/rsrc">
<fileset dir="rsrc" includes="**/*"/>
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset refid="${lib.name}.libs"/>
</copy>
<!-- end TEMP -->
<path id="compile.classpath">
<path refid="complibs.classpath"/>
<fileset dir="${deploy.dir}/lib" includes="**/*.jar"/>
</path>
<path id="built.classpath">
<path refid="compile.classpath"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.classpath">
<path refid="testlibs.classpath"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="-check-available" depends="-prepare">
<available property="lwjgl.present"
classname="org.lwjgl.LWJGLException" classpathref="compile.classpath"/>
<echo level="info" message="Have LWJGL: ${lwjgl.present}"/>
<available property="jorbis.present"
classname="com.jcraft.jorbis.Info" classpathref="compile.classpath"/>
<echo level="info" message="Have JOrbis: ${jorbis.present}"/>
<available property="jl.present"
classname="javazoom.jl.decoder.Decoder" classpathref="compile.classpath"/>
<echo level="info" message="Have JL: ${jl.present}"/>
<condition property="build.openal">
<and>
<isset property="lwjgl.present"/>
<isset property="jorbis.present"/>
<isset property="jl.present"/>
</and>
</condition>
</target>
<!-- makes sure our tools are compiled and defines the ant tasks -->
<target name="preptools" depends="prepare">
<taskdef resource="com/threerings/presents/tools.properties" classpathref="classpath"/>
<target name="-preptools" depends="-prepare">
<artifact:dependencies pathId="tools.classpath">
<!-- TODO: we should publish a narya-tools "artifact" which has the
javassist dependency listed as non-optional -->
<dependency groupId="javassist" artifactId="javassist" version="3.8.0.GA"/>
<dependency groupId="com.threerings" artifactId="narya" version="1.0"/>
</artifact:dependencies>
<taskdef resource="com/threerings/presents/tools.properties" classpathref="tools.classpath"/>
</target>
<!-- cleans out the intermediate build files -->
@@ -57,16 +117,22 @@
<!-- common clean tasks -->
<target name="common-clean">
<ant dir="tests" target="clean"/>
<!--
<delete file="rsrc/bundles/tiles/tilesets.map"/>
<delete file="rsrc/bundles/components/components.map"/>
<delete file="rsrc/bundles/components/metadata.jar"/>
<delete><fileset dir="rsrc/bundles/tiles" includes="**/bundle.jar"/></delete>
<delete><fileset dir="rsrc/bundles/components" includes="**/components.jar"/></delete>
-->
</target>
<!-- build the java class files -->
<target name="compile" depends="check-available,prepare">
<target name="compile" depends="-check-available">
<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="classpath"/>
<classpath refid="compile.classpath"/>
<exclude name="com/threerings/openal/**" unless="build.openal"/>
<exclude name="com/threerings/**/tools/xml/**" unless="build.xml"/>
<exclude name="**/OggPlayer.java"/>
<exclude name="**/ModPlayer.java"/>
<exclude name="**/MidiPlayer.java"/>
@@ -75,19 +141,28 @@
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
</javac>
<mkdir dir="${tclasses.dir}"/>
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="off" deprecation="off">
<classpath refid="test.classpath"/>
<exclude name="com/threerings/openal/**" unless="build.openal"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<!-- adds readField and writeField methods to Stremable classes -->
<target name="procstream" depends="preptools">
<target name="procstream" depends="-preptools">
<instream outdir="${classes.dir}">
<path refid="classpath"/>
<path refid="built.classpath"/>
<fileset dir="${classes.dir}" includes="**/data/*.class"/>
<fileset dir="${classes.dir}" includes="**/util/*.class"/>
</instream>
</target>
<!-- checks whether our Flash library needs building -->
<target name="checkaslib">
<target name="-checkaslib">
<condition property="no_build_aslib"><or>
<not><available file="${flexsdk.dir}/lib/compc.jar"/></not>
<uptodate targetfile="${deploy.dir}/${lib.name}lib.swc">
@@ -97,7 +172,7 @@
</target>
<!-- builds our Flash library -->
<target name="aslib" unless="no_build_aslib" depends="checkaslib">
<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}"/>
@@ -118,7 +193,7 @@
<!-- installs the pre-built native libraries -->
<condition property="isunix"><os family="unix"/></condition>
<target name="ninstall" depends="prepare" if="isunix">
<target name="ninstall" depends="-prepare" if="isunix">
<exec os="Linux" dir="${src.dir}/com/threerings/util/keybd/Linux" executable="make">
<arg line="install"/>
</exec>
@@ -129,13 +204,13 @@
</target>
<!-- build the javadoc documentation -->
<target name="javadoc" depends="prepare">
<target name="javadoc" depends="-prepare">
<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="classpath"/>
<classpath refid="compile.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"/>
@@ -149,7 +224,7 @@
</target>
<!-- builds the ActionScript documention -->
<target name="asdoc" unless="no_build_aslib" depends="checkaslib">
<target name="asdoc" unless="no_build_aslib" depends="-checkaslib">
<mkdir dir="${deploy.dir}/asdocs"/>
<java classpath="${flexsdk.dir}/lib/asdoc.jar" classname="flex2.tools.ASDoc" fork="true">
<jvmarg value="-Xmx1024m"/>
@@ -164,19 +239,15 @@
</java>
</target>
<target name="tcompile" description="Builds (but does not run) the tests.">
<ant dir="tests" target="compile" inheritAll="false"/>
</target>
<target name="tests" description="Builds and runs the tests.">
<ant dir="tests" target="tests" inheritAll="false"/>
<target name="tests" depends="compile" description="Builds and runs the tests.">
<!-- TODO -->
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,prepare,compile,ninstall,tests,javadoc,dist"/>
<target name="all" depends="clean,-prepare,compile,ninstall,tests,javadoc,dist"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile,tcompile,procstream,ninstall,aslib">
<target name="dist" depends="-prepare,compile,procstream,ninstall,aslib">
<!-- build our various jar files -->
<jar destfile="${deploy.dir}/${lib.name}-rsrc.jar">
<fileset dir="${classes.dir}" includes="com/threerings/resource/**"/>
@@ -208,7 +279,7 @@
<!-- a helper task for 'retro' -->
<target name="vweave">
<!-- various bits used by the retroweaver tasks -->
<taskdef name="weave" classpathref="classpath"
<taskdef name="weave" classpathref="built.classpath"
classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
<property name="inpre" value="${deploy.dir}/${lib.name}"/>
<property name="outpre" value="${deploy.dir}/retro/${lib.name}"/>
@@ -243,29 +314,8 @@
<antcall target="vweave"><param name="which" value="rsrc"/></antcall>
</target>
<!-- generate a class hierarchy diagram -->
<target name="hierviz" depends="prepare,compile">
<taskdef name="viztool" classname="com.samskivert.viztool.DriverTask"/>
<viztool visualizer="com.samskivert.viztool.hierarchy.HierarchyVisualizer"
pkgroot="com.threerings.miso" classes="com.threerings.miso.*"
output="hierviz.ps">
<classpath refid="classpath"/>
</viztool>
</target>
<!-- generate a class hierarchy diagram -->
<target name="sumgen" depends="prepare,compile">
<taskdef name="viztool" classname="com.samskivert.viztool.DriverTask"/>
<viztool visualizer="com.samskivert.viztool.summary.SummaryVisualizer"
pkgroot="com.threerings.miso"
classes="com.threerings.miso.*Scene.*"
output="summary.ps">
<classpath refid="base.classpath"/>
</viztool>
</target>
<!-- generates ActionScript versions of our Streamable classes -->
<target name="genascript" depends="preptools">
<target name="genascript" depends="-preptools">
<genascript header="lib/SOURCE_HEADER" asroot="src/as">
<fileset dir="${src.dir}" includes="**/data/*.java"/>
</genascript>
@@ -278,13 +328,11 @@
<tar destfile="../nenya-snapshot.tar.gz" compression="gzip">
<tarfileset dir=".." mode="0775" dirmode="0775">
<include name="nenya/bin/**"/>
<include name="nenya/tests/bin/**"/>
<exclude name="**/.svn"/>
</tarfileset>
<tarfileset dir=".." mode="0664" dirmode="0775">
<include name="nenya/**"/>
<exclude name="**/.svn"/>
<exclude name="nenya/tests/dist/**"/>
<exclude name="nenya/dist/**"/>
<exclude name="nenya/code/**"/>
<exclude name="nenya/nenya-*.*"/>
@@ -295,7 +343,6 @@
<fileset dir="..">
<include name="nenya/**"/>
<exclude name="**/.svn"/>
<exclude name="nenya/tests/dist/**"/>
<exclude name="nenya/dist/**"/>
<exclude name="nenya/code/**"/>
<exclude name="nenya/nenya-*.*"/>
@@ -312,7 +359,6 @@
<fileset dir=".">
<include name="**"/>
<exclude name="dist/**"/>
<exclude name="tests/dist/**"/>
<exclude name="${lib.name}-*.zip"/>
</fileset>
</copy>