Files
getdown/build.xml
T
Michael Bayne 89229b16cd Now that the JDK is open source, we can just fork JarDiff and eliminate our
annoying dependency on javaws.jar (which no longer even includes JarDiff, now
that lives in $JAVA_HOME/samples/jnlp/servlet/jardiff.jar). We had already
forked JarDiffPatcher, so this completes the circle. Now I can also directly
fix some of the annoying JarDiff bugs we were working around, which I'll do at
some point.
2010-09-20 18:42:41 +00:00

166 lines
6.4 KiB
XML

<!-- build configuration -->
<project name="getdown" default="compile" basedir=".">
<!-- various basic settings -->
<property name="app.name" value="getdown"/>
<property name="src.dir" value="src/main/java"/>
<property name="test.dir" value="src/test/java"/>
<property name="deploy.dir" value="dist"/>
<property name="libs.dir" value="lib"/>
<import file="etc/libs-incl.xml"/>
<!-- these are only used if we're going to sign things -->
<property file="build.properties"/>
<property file="${cert_dir}/certificate.properties"/>
<!-- used when generating javadocs -->
<property name="javadoc.dir" value="${deploy.dir}/docs"/>
<property name="doc.packages" value="com.threerings.getdown.*"/>
<property name="doc.overview" value="com/threerings/getdown/overview.html"/>
<property name="copy.pre" value="Copyright &#169; 2010"/>
<property name="copyright.holder" value="Three Rings Design, Inc."/>
<property name="copy.post" value="All Rights Reserved."/>
<!-- declare our classpath -->
<path id="clazzpath">
<pathelement location="${deploy.dir}/classes"/>
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
</path>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}/lib"/>
<mkdir dir="${deploy.dir}/classes"/>
<mkdir dir="${deploy.dir}/test-classes"/>
<mkdir dir="${javadoc.dir}"/>
<!-- copy media and properties into the target directory -->
<copy todir="${deploy.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.jpg"/>
<fileset dir="${src.dir}" includes="**/*.png"/>
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<copy todir="${deploy.dir}/lib">
<fileset dir="lib" includes="**/*.jar"/>
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset refid="${app.name}.libs"/>
</copy>
</target>
<!-- cleans out the intermediate build files -->
<target name="clean">
<delete dir="${deploy.dir}/classes"/>
<delete dir="${deploy.dir}/test-classes"/>
<delete dir="${deploy.dir}/docs"/>
</target>
<!-- wipes the entire build directory clean -->
<target name="distclean" depends="clean">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles main classes.">
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes" includeAntRuntime="no"
classpathref="clazzpath" debug="on" deprecation="on" source="1.5" target="1.5">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<target name="test-compile" depends="compile" description="Compiles test classes.">
<javac srcdir="${test.dir}" destdir="${deploy.dir}/test-classes" includeAntRuntime="false"
debug="on" deprecation="on" source="1.5" target="1.5" encoding="utf-8">
<classpath>
<path refid="clazzpath"/>
<pathelement location="${deploy.dir}/classes"/>
</classpath>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<!-- build the javadoc documentation -->
<target name="javadoc" depends="prepare">
<javadoc sourcepath="${src.dir}"
packagenames="${doc.packages}"
windowtitle="${app.name} API"
doctitle="${app.name} API"
overview="${src.dir}/${doc.overview}"
bottom="${copy.pre} ${copyright.holder} ${copy.post}"
destdir="${javadoc.dir}">
<classpath refid="clazzpath"/>
<link href="http://samskivert.com/code/samskivert/samskivert/docs/api"/>
<link href="http://java.sun.com/j2se/1.5/docs/api/"/>
</javadoc>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,compile,javadoc,dist"/>
<!-- builds our distribution files -->
<target name="dist" depends="compile">
<jar destfile="${deploy.dir}/${app.name}.jar" manifest="lib/manifest.mf"
basedir="${deploy.dir}/classes" excludes="**/netscape/**"/>
</target>
<property name="test" value=""/>
<target name="tests" depends="test-compile"
description="Runs unit tests. Use -Dtest=Foo to run only FooTest.">
<taskdef name="unit" classpathref="clazzpath"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<unit printsummary="off" haltonfailure="yes">
<classpath>
<pathelement location="${deploy.dir}/classes"/>
<pathelement location="${deploy.dir}/test-classes"/>
<fileset dir="${deploy.dir}/lib" includes="*.jar"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${test.dir}" includes="**/*${test}*Test.java"/>
</batchtest>
</unit>
</target>
<!-- optimizes, combines and removes dead code -->
<target name="proguard" depends="dist">
<!-- we need ant-contrib for if -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${deploy.dir}/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<!-- figure out where the Java rt.jar file lives -->
<if><and><os family="mac"/><os family="unix"/></and><then>
<property name="rtClasses" value="${java.home}/../Classes/classes.jar"/>
</then><else>
<property name="rtClasses" value="${java.home}/lib/rt.jar"/>
</else></if>
<mkdir dir="${deploy.dir}"/>
<taskdef resource="proguard/ant/task.properties"
classpath="${deploy.dir}/lib/proguard.jar"/>
<proguard configuration="etc/getdown.pro">
<libraryjar name="${rtClasses}"/>
</proguard>
<taskdef name="weave" classname="com.rc.retroweaver.ant.RetroWeaverTask"
classpath="${deploy.dir}/lib/retroweaver-all-1.2.2.jar"/>
<weave inputjar="${basedir}/${deploy.dir}/${app.name}-pro.jar"
outputjar="${basedir}/${deploy.dir}/${app.name}-retro-pro.jar"/>
<!-- now combine the retroweaved jar file with the retroweaver runtime -->
<unjar src="${deploy.dir}/lib/retroweaver-rt-1.2.2.jar"
dest="${deploy.dir}/rptmp"/>
<jar destfile="${deploy.dir}/${app.name}-retro-pro.jar"
manifest="lib/manifest.mf" basedir="${deploy.dir}/rptmp" update="true"/>
<delete dir="${deploy.dir}/rptmp"/>
</target>
<target name="sign" depends="proguard">
<signjar jar="${deploy.dir}/${app.name}-retro-pro.jar" lazy="true"
keystore="${sign.keystore}" storepass="${sign.storepass}"
alias="${sign.alias}" keypass="${sign.keypass}"/>
</target>
</project>