-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
408 lines (310 loc) · 13.9 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
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!--
General purpose build script for web applications and web services,
including enhanced support for deploying directly to a Tomcat 5
based server.
This build script assumes that the source code of your web application
is organized into the following subdirectories underneath the source
code directory from which you execute the build script:
docs Static documentation files to be copied to
the "docs" subdirectory of your distribution.
src Java source code (and associated resource files)
to be compiled to the "WEB-INF/classes"
subdirectory of your web applicaiton.
web Static HTML, JSP, and other content (such as
image files), including the WEB-INF subdirectory
and its configuration file contents.
$Id: build.xml.txt 565211 2007-08-13 00:09:38Z markt $
-->
<!-- A "project" describes a set of targets that may be requested
when Ant is executed. The "default" attribute defines the
target which is executed if no specific target is requested,
and the "basedir" attribute defines the current working directory
from which Ant executes the requested task. This is normally
set to the current working directory.
-->
<project name="Gote Farm" default="compile" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the developer's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<!--
These properties generally define file and directory names (or paths) that
affect where the build process stores its outputs.
build.home The directory into which the "compile" target will
generate its output.
app.version Version number of this iteration of the application.
-->
<property name="build.home" value="${basedir}/war/WEB-INF/classes"/>
<property name="src.home" value="${basedir}/src/main"/>
<property name="test.src.home" value="${basedir}/src/test"/>
<property name="test.build.home" value="${basedir}/test_build"/>
<property name="lib.home" value="${basedir}/lib"/>
<!-- Check that the SDK value is set and seems sane, so we can give a nicer
error if not. -->
<fail message="Please define the appengine.sdk property to point to your SDK directory">
<condition>
<not> <and>
<isset property="appengine.sdk"/>
<available file="${appengine.sdk}/config/user/ant-macros.xml"/>
</and> </not>
</condition>
</fail>
<!-- Pick up the Ant macros and taskdefs for App Engine -->
<import file="${appengine.sdk}/config/user/ant-macros.xml"/>
<!-- ================== Custom Ant Task Definitions ======================= -->
<path id="scala.classpath">
<pathelement location="${scala-compiler.jar}"/>
<pathelement location="${scala-library.jar}"/>
</path>
<path id="test.classpath">
<path refid="scala.classpath"/>
<path location="${build.home}"/>
<path location="${lib.home}/junit.jar"/>
</path>
<path id="project.class.path">
<path refid="scala.classpath"/>
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
</path>
<path id="tools.class.path">
<path refid="project.class.path"/>
<pathelement location="${appengine.sdk}/lib/appengine-tools-api.jar"/>
<fileset dir="${appengine.sdk}/lib/tools">
<include name="**/asm-*.jar"/>
<include name="**/datanucleus-enhancer-*.jar"/>
</fileset>
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath refid="scala.classpath"/>
</taskdef>
<!-- ==================== Compilation Control Options ==================== -->
<!--
These properties control option settings on the Javac compiler when it
is invoked using the <javac> task.
compile.debug Should compilation include the debug option?
compile.deprecation Should compilation include the deprecation option?
compile.optimize Should compilation include the optimize option?
-->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<!-- ==================== External Dependencies =========================== -->
<!--
Use property values to define the locations of external JAR files on which
your application will depend. In general, these values will be used for
two purposes:
* Inclusion on the classpath that is passed to the Javac compiler
* Being copied into the "/WEB-INF/lib" directory during execution
of the "deploy" target.
Because we will automatically include all of the Java classes that Tomcat 5
exposes to web applications, we will not need to explicitly list any of those
dependencies. You only need to worry about external dependencies for JAR
files that you are going to include inside your "/WEB-INF/lib" directory.
-->
<!-- Dummy external dependency -->
<!--
<property name="foo.jar"
value="/path/to/foo.jar"/>
-->
<!-- ==================== All Target ====================================== -->
<!--
The "all" target is a shortcut for running the "clean" target followed
by the "compile" target, to force a complete recompile.
-->
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="war/${gwt-output.dir}"/>
<delete dir="war/WEB-INF/lib"/>
</target>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into object files in the appropriate location in the build directory.
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes".
-->
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<!-- Add any additional server libs that need to be copied -->
<copy todir="war/WEB-INF/lib">
<fileset dir="${lib.home}" excludes="junit.jar" />
</copy>
<copy todir="war/WEB-INF/lib" flatten="true">
<fileset dir="${appengine.sdk}/lib/user" includes="**/*.jar"/>
</copy>
<copy todir="war/WEB-INF/lib" file="${scala-library.jar}" />
<copy todir="war/WEB-INF/lib" file="${slf4j-api.jar}" />
<copy todir="war/WEB-INF/lib" file="${slf4j-impl.jar}" />
</target>
<target name="compile_java" depends="libs"
description="Compile Java sources">
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}"/>
<javac srcdir="${src.home}"
destdir="${build.home}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xlint:deprecation"/>
<classpath refid="project.class.path"/>
</javac>
<taskdef
name="datanucleusenhancer"
classpathref="tools.class.path"
classname="org.datanucleus.enhancer.tools.EnhancerTask" />
<datanucleusenhancer
classpathref="tools.class.path"
failonerror="true">
<fileset dir="war/WEB-INF/classes" includes="**/*.class" />
</datanucleusenhancer>
</target>
<target name="compile_scala" depends="compile_java"
description="Compile Scala sources">
<!-- Compile Java classes as necessary -->
<scalac
srcdir="${src.home}"
destdir="${build.home}"
force="changed"
deprecation="yes">
<classpath refid="project.class.path"/>
<include name="**/*.java"/>
<include name="**/*.scala"/>
</scalac>
</target>
<target name="compile" depends="compile_java,compile_scala"
description="Compile Java and Scala sources">
<!-- Copy application resources -->
<copy todir="${build.home}">
<fileset dir="${src.home}" excludes="**/*.java **/*.scala"/>
</copy>
</target>
<target name="gwtc" depends="compile" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${src.home}"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<jvmarg value="-XstartOnFirstThread"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="${gwt-xml-ep.name}"/>
</java>
</target>
<target name="hosted" depends="compile" description="Run hosted mode">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.HostedMode">
<classpath>
<pathelement location="${src.home}"/>
<path refid="project.class.path"/>
<path refid="tools.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-XstartOnFirstThread"/>
<arg value="-startupUrl"/>
<arg value="GoteFarm.html"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="-server"/>
<arg value="com.google.appengine.tools.development.gwt.AppEngineLauncher"/>
<arg value="${gwt-xml-ep.name}"/>
</java>
</target>
<target name="build" depends="gwtc" description="Build this project" />
<!-- ==================== war Target ================================== -->
<target name="war" depends="build">
<zip destfile="gotefarm.war" basedir="war"/>
</target>
<target name="deploy" depends="war">
<copy todir="${catalina.home}/webapps/" file="gotefarm.war"/>
</target>
<!-- ==================== App Engine Tasks ================================== -->
<target name="update" depends="build"
description="Uploads the application to App Engine.">
<appcfg action="update" war="war" />
</target>
<target name="update_indexes" depends="build"
description="Uploads just the datastore index configuration to App Engine.">
<appcfg action="update_indexes" war="war" />
</target>
<target name="rollback" depends="build"
description="Rolls back an interrupted application update.">
<appcfg action="rollback" war="war" />
</target>
<target name="request_logs"
description="Downloads log data from App Engine for the application.">
<appcfg action="request_logs" war="war">
<options>
<arg value="--num_days=5"/>
</options>
<args>
<arg value="logs.txt"/>
</args>
</appcfg>
</target>
<!-- ==================== Tests Target =================================== -->
<target name="test_compile" depends="compile">
<mkdir dir="${test.build.home}"/>
<scalac srcdir="${test.src.home}"
destdir="${test.build.home}"
classpathref="test.classpath"
target="jvm-1.5"
unchecked="on"
deprecation="on"
optimise="on">
<include name="**/*.scala"/>
</scalac>
</target>
<macrodef name="tests_macro">
<attribute name="test.classes.regex"/>
<sequential>
<mkdir dir="test"/>
<mkdir dir="test/classes"/>
<copy file="test-log4j.properties"
tofile="test/classes/log4j.properties"/>
<junit printsummary="yes" haltonerror="yes" haltonfailure="yes">
<classpath>
<path refid="test.classpath"/>
<path location="${test.build.home}"/>
<path location="test/classes"/>
</classpath>
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset dir="${test.build.home}"
includes="@{test.classes.regex}"/>
</batchtest>
</junit>
</sequential>
</macrodef>
<target name="tests" depends="test_compile">
<tests_macro test.classes.regex="**/*Test.class"/>
</target>
</project>