Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Ant build's been deprecated for ages."
This reverts commit 12f7b66. So it turns out despite getdown being public and having an automatic travis build we still have an internal build. Which uses ant. And requires blood sacrifices to cope with maven. I'm really not in the mood to deal with it/don't have access to set up the travis build to publish snapshots, so I'm just going to revert and let someone else with more motivation clean up this mess (or not)
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?xml version="1.0"?> | ||
<project name="getdown" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant"> | ||
<property name="src.dir" value="src/main/java"/> | ||
<property name="rsrc.dir" value="src/main/resources"/> | ||
<property name="tsrc.dir" value="src/test/java"/> | ||
<property name="deploy.dir" value="dist"/> | ||
|
||
<property file="${cert_dir}/certificate.properties"/> | ||
|
||
<property name="maven-ant.vers" value="2.1.3"/> | ||
<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> | ||
|
||
<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"> | ||
<mkdir dir="${deploy.dir}"/> | ||
<path id="built.classpath"> | ||
<path refid="compile.classpath"/> | ||
<pathelement location="${deploy.dir}/classes"/> | ||
</path> | ||
<path id="test.classpath"> | ||
<path refid="testlibs.classpath"/> | ||
<path refid="built.classpath"/> | ||
<pathelement location="${deploy.dir}/test-classes"/> | ||
</path> | ||
</target> | ||
|
||
<target name="clean" description="Cleans out build results."> | ||
<delete dir="${deploy.dir}/classes"/> | ||
<delete dir="${deploy.dir}/test-classes"/> | ||
<delete dir="${deploy.dir}/docs"/> | ||
</target> | ||
|
||
<target name="distclean" description="Scorched earth clean."> | ||
<delete dir="${deploy.dir}"/> | ||
</target> | ||
|
||
<target name="compile" depends="-prepare" description="Compiles main and test classes."> | ||
<mkdir dir="${deploy.dir}/classes"/> | ||
<copy todir="${deploy.dir}/classes"><fileset dir="src/main/resources" includes="**"/></copy> | ||
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes" includeAntRuntime="no" | ||
classpathref="compile.classpath" debug="on" deprecation="on" source="1.5" target="1.5" | ||
encoding="utf-8"> | ||
<compilerarg value="-Xlint"/> | ||
<compilerarg value="-Xlint:-serial"/> | ||
</javac> | ||
|
||
<mkdir dir="${deploy.dir}/test-classes"/> | ||
<javac srcdir="${tsrc.dir}" destdir="${deploy.dir}/test-classes" includeAntRuntime="false" | ||
classpathref="test.classpath" debug="on" deprecation="on" source="1.5" target="1.5" | ||
encoding="utf-8"> | ||
<compilerarg value="-Xlint"/> | ||
<compilerarg value="-Xlint:-serial"/> | ||
</javac> | ||
</target> | ||
|
||
<property name="test" value=""/> | ||
<target name="tests" depends="compile" | ||
description="Runs unit tests. Use -Dtest=Foo to run only FooTest."> | ||
<taskdef name="unit" classpathref="test.classpath" | ||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/> | ||
<unit printsummary="off" haltonfailure="yes"> | ||
<classpath> | ||
<path refid="test.classpath"/> | ||
</classpath> | ||
<formatter type="brief" usefile="false"/> | ||
<batchtest> | ||
<fileset dir="${tsrc.dir}" includes="**/*${test}*Test.java"/> | ||
</batchtest> | ||
</unit> | ||
</target> | ||
|
||
<target name="javadoc" depends="-prepare"> | ||
<javadoc sourcepath="${src.dir}" packagenames="com.threerings.getdown.*" | ||
windowtitle="${ant.project.name} API" doctitle="${ant.project.name} API" | ||
overview="${src.dir}/com/threerings/getdown/overview.html" | ||
bottom="Copyright © 2004-2011 Three Rings Design, Inc. All Rights Reserved." | ||
destdir="${deploy.dir}/docs"> | ||
<classpath refid="compile.classpath"/> | ||
<link href="http://java.sun.com/j2se/1.5/docs/api/"/> | ||
</javadoc> | ||
</target> | ||
|
||
<target name="dist" depends="compile" description="Builds jar file."> | ||
<jar destfile="${deploy.dir}/${ant.project.name}-bare.jar" manifest="lib/manifest.mf" | ||
basedir="${deploy.dir}/classes"/> | ||
</target> | ||
|
||
<target name="proguard" depends="dist" description="Builds dependencies included jar file."> | ||
<!-- locate the platform classes --> | ||
<condition property="rt.jar" value="${java.home}/../Classes/classes.jar"> | ||
<available file="${java.home}/../Classes/classes.jar"/> | ||
</condition> | ||
<condition property="rt.jar" value="${java.home}/lib/rt.jar"> | ||
<available file="${java.home}/lib/rt.jar"/> | ||
</condition> | ||
<!-- set up the proguard task --> | ||
<artifact:dependencies pathId="proguard.classpath"> | ||
<dependency groupId="net.sf.proguard" artifactId="proguard-anttask" version="4.8"/> | ||
</artifact:dependencies> | ||
<taskdef resource="proguard/ant/task.properties" classpathref="proguard.classpath"/> | ||
|
||
<!-- build the dependencies included jar file --> | ||
<proguard> | ||
<injar path="${deploy.dir}/${ant.project.name}-bare.jar"/> | ||
<injar path="${jregistrykey:jregistrykey:jar}" filter="!META-INF/**"/> | ||
<injar path="${com.samskivert:samskivert:jar}" filter="!META-INF/**, | ||
!**/Log4JLogger*,!**/*.java,com/samskivert/Log.class,**/samskivert/io/**, | ||
**/samskivert/swing/**,**/samskivert/text/**,**/samskivert/util/**"/> | ||
<injar path="${commons-codec:commons-codec:jar}" filter="!META-INF/**"/> | ||
<outjar path="${deploy.dir}/${ant.project.name}.jar"/> | ||
<libraryjar name="${rt.jar}"/> | ||
<libraryjar name="${org.apache.ant:ant:jar}"/> | ||
<libraryjar name="${java:plugin:jar}"/> | ||
|
||
<!-- keep the whole nine yards, just trim/obfuscate our depends --> | ||
<keep name="com.threerings.getdown.**"> | ||
<constructor/><method name="*"/><field name="*"/> | ||
</keep> | ||
<keep name="ca.beq.util.win32.registry.**"> | ||
<constructor/><method name="*"/><field access="public" name="*"/> | ||
</keep> | ||
</proguard> | ||
</target> | ||
|
||
<target name="sign" depends="compile"> | ||
<signjar jar="${deploy.dir}/${ant.project.name}-retro-pro.jar" lazy="true" | ||
keystore="${sign.keystore}" storepass="${sign.storepass}" | ||
alias="${sign.alias}" keypass="${sign.keypass}"/> | ||
</target> | ||
|
||
<property name="maven.deploy.repo" value="file://${user.home}/.m2/repository"/> | ||
<target name="maven-deploy" depends="proguard" | ||
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> | ||
</target> | ||
</project> |