-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
325 lines (301 loc) · 14.4 KB
/
Copy pathbuild.xml
File metadata and controls
325 lines (301 loc) · 14.4 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<?xml version="1.0" standalone="yes"?>
<!-- build configuration -->
<project name="whirled" 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="tsrc.dir" value="src/test/java"/>
<property name="asrc.dir" value="src/main/as"/>
<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.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://www.apache.org/dyn/closer.cgi/maven/ant-tasks/${maven-ant.vers}/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="-check-ooo">
<available property="threerings.present" classname="com.threerings.user.OOOUser"
classpathref="compile.classpath"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${deploy.dir}"/>
<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="-preptools" depends="-prepare">
<taskdef resource="com/threerings/presents/tools.properties" classpathref="compile.classpath"/>
</target>
<target name="clean" description="Cleans out build results">
<delete dir="${deploy.dir}/classes"/>
<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>
</target>
<target name="distclean" description="Scorched earth clean">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="-prepare,-check-ooo" description="Builds the Java code.">
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}"><fileset dir="src/main/resources" includes="**"/></copy>
<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"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-unchecked"/> <!-- TODO: fix -->
<exclude name="com/threerings/toybox/server/ooo/**" unless="threerings.present"/>
</javac>
<mkdir dir="${tclasses.dir}"/>
<copy todir="${tclasses.dir}"><fileset dir="src/test/resources" includes="**"/></copy>
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" source="1.5" target="1.5"
encoding="utf-8" classpathref="test.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</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="-prepare,-checkaslib,-noteaslib"
description="Builds the ActionScript code">
<!-- 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 dir="lib" includes="as3isolib-*.swc"/>
<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>
<target name="checkwhirledthanelib">
<condition property="no_build_whirledthanelib"><or>
<not><available file="${flexsdk.dir}/lib/compc.jar"/></not>
<!-- thane builds are only done inside OOO due to overreaching complexity -->
<not><isset property="ooo.maven.depends.repo"/></not>
<uptodate targetfile="${deploy.dir}/whirledthanelib.swc">
<srcfiles dir="${deploy.dir}/lib" includes="*.swc"/>
<srcfiles dir="${deploy.dir}" includes="*.swc"/>
<srcfiles dir="src/main/thane" includes="**/*.as"/>
</uptodate>
</or></condition>
</target>
<target name="whirledthanelib" unless="no_build_whirledthanelib"
depends="checkwhirledthanelib,aslib">
<!-- obtain our Thane dependencies via Maven -->
<artifact:dependencies filesetId="thane.fileset">
<remoteRepository id="ooo.repo" url="${ooo.maven.depends.repo}"/>
<dependency groupId="com.threerings.thane" artifactId="thane"
version="0.0-SNAPSHOT" type="swc"/>
<dependency groupId="com.threerings.thane" artifactId="http"
version="0.0-SNAPSHOT" type="swc"/>
</artifact:dependencies>
<copy todir="${deploy.dir}/lib">
<fileset refid="thane.fileset"/>
<mapper type="flatten"/>
</copy>
<copy file="etc/thane-config.xml.in" tofile="${deploy.dir}/thane-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
</filterset>
</copy>
<java jar="${flexsdk.dir}/lib/compc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="dist/thane-config.xml"/>
<arg value="-compiler.external-library-path"/>
<arg value="${deploy.dir}/lib/thane-0.0-SNAPSHOT.swc"/>
<arg value="${deploy.dir}/lib/aspirin-1.6.swc"/>
<arg value="${com.threerings:naryalib:swc}"/>
<arg value="${com.threerings:nenyalib:swc}"/>
<arg value="${com.threerings:vilyalib:swc}"/>
<arg value="${deploy.dir}/whirledlib.swc"/>
<arg value="-compiler.source-path=src/main/thane"/>
<arg value="-include-classes"/>
<arg value="com.whirled.thane.HttpUserCode"/>
<arg value="com.whirled.thane.HttpUserCodeLoader"/>
<arg value="-output"/>
<arg value="${deploy.dir}/whirledthanelib.swc"/>
</java>
</target>
<target name="javadoc" depends="-prepare" description="Builds the Java documentation">
<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/vilya/docs/api">
<classpath refid="compile.classpath"/>
<link href="http://java.sun.com/j2se/1.5/docs/api/"/>
</javadoc>
<copy todir="${deploy.dir}/docs">
<fileset dir="${src.dir}" includes="**/*.png"/>
</copy>
</target>
<target name="asdoc" unless="no_build_aslib" depends="-checkaslib"
description="Builds the ActionScript documention">
<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 ${com.threerings:naryalib:swc}"/>
<arg line="-library-path ${com.threerings:nenyalib:swc}"/>
<arg line="-templates-path ${flexsdk.dir}/asdoc/templates"/>
<arg line="-doc-sources ${asrc.dir}"/>
<arg line="-output ${deploy.dir}/asdocs"/>
</java>
</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"/>
<mkdir dir="${deploy.dir}/test-reports"/>
<unit printsummary="off" haltonfailure="yes">
<classpath refid="test.classpath"/>
<sysproperty key="test_dir" value="${tclasses.dir}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${deploy.dir}/test-reports">
<fileset dir="${tsrc.dir}" includes="**/*${test}*Test.java"/>
</batchtest>
</unit>
</target>
<target name="dist" depends="compile,aslib,whirledthanelib" description="Builds jar files.">
<!-- stick all our code in one jar file -->
<jar file="${deploy.dir}/${ant.project.name}-code.jar" basedir="${classes.dir}">
<include name="com/**"/>
<include name="*.properties"/>
<include name="rsrc/**/*.properties"/>
<include name="rsrc/**/*.tmpl"/>
</jar>
<!-- and all of our configuration and media in another -->
<jar file="${deploy.dir}/${ant.project.name}-media.jar" basedir="." includes="rsrc/**"/>
<!-- and our server-only data in yet another -->
<jar file="${deploy.dir}/${ant.project.name}-data.jar" basedir="."
includes="data/dictionary/**"/>
</target>
<target name="genrecord" depends="-prepare"
description="Generates fields for persistent record classes.">
<taskdef name="grecord" classname="com.samskivert.depot.tools.GenRecordTask"
classpathref="compile.classpath"/>
<!-- make sure the record class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on">
<classpath refid="compile.classpath"/>
<include name="**/*Record.java"/>
</javac>
<!-- now update the source files -->
<grecord classpathref="built.classpath">
<fileset dir="${src.dir}" includes="**/*Record.java"/>
</grecord>
</target>
<target name="gendobj" depends="-preptools"
description="Generates additional methods for distributed object classes">
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.5" target="1.5" classpathref="compile.classpath">
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<gendobj classpathref="built.classpath">
<fileset dir="${src.dir}" includes="**/*Object.java"/>
</gendobj>
</target>
<target name="genservice" depends="-preptools"
description="Generates marshaller and dispatcher classes for all invocation services">
<!-- make sure the service class files are all compiled -->
<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"/>
<include name="**/*Service.java"/>
</javac>
<genservice header="lib/SOURCE_HEADER" asroot="${asrc.dir}" classpathref="built.classpath">
<fileset dir="${src.dir}">
<include name="**/client/*Service.java"/>
</fileset>
</genservice>
</target>
<target name="genascript" depends="-preptools"
description="Generates ActionScript versions of our Streamable classes">
<!-- now generate the associated files -->
<genascript header="lib/SOURCE_HEADER" asroot="${asrc.dir}">
<fileset dir="${src.dir}">
<include name="**/whirled/data/*.java"/>
</fileset>
</genascript>
</target>
<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.">
<artifact:deploy file="${deploy.dir}/${ant.project.name}-code.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="pom"/>
</artifact:deploy>
<artifact:pom id="data-pom" file="etc/data-pom.xml"/>
<artifact:deploy file="${deploy.dir}/${ant.project.name}-data.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="data-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>
<artifact:pom id="thane-pom" file="etc/thane-pom.xml"/>
<artifact:deploy file="${deploy.dir}/${ant.project.name}thanelib.swc" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="thane-pom"/>
</artifact:deploy>
</target>
</project>