forked from threerings/getdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
157 lines (141 loc) · 7.01 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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://central.maven.org/maven2/org/apache/maven/maven-ant-tasks/${maven-ant.vers}"/>
<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>