-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
469 lines (392 loc) · 19.5 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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
<project name="joda-time" default="jar" basedir=".">
<!-- Joda-time ANT script -->
<!-- Based on scripts from Apache Jakarta Commons and elsewhere -->
<!-- This is the recommended way to build Joda-Time. -->
<!-- Maven is only intended for building the website. -->
<!-- This ant file will download junit-3.8.1.jar to the lib subdirectory -->
<!-- automatically if it does not find it there already. To change this -->
<!-- behaviour, override the junit.jar property in build.properties. -->
<!-- ========== Properties ================================================ -->
<property file="build.properties"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="joda-time"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.joda.time"/>
<!-- The title of this component -->
<property name="component.title" value="Joda date and time"/>
<!-- The current version number of this component -->
<property name="component.version" value="2.0"/>
<property name="previous.version" value="1.6"/>
<!-- The current version number of this component -->
<property name="component.fullname" value="${component.name}-${component.version}"/>
<!-- The directory of source files -->
<property name="xdocs" value="xdocs"/>
<!-- Dependencies -->
<property name="lib" value="lib"/>
<property name="junit.jar" value="${lib}/junit-3.8.2.jar"/>
<property name="jodaconvert.jar" value="${lib}/joda-convert-1.1.jar"/>
<!-- The directory of source files -->
<property name="source" value="src"/>
<property name="source.home" value="${source}/main/java"/>
<property name="source.tz" value="${source.home}/org/joda/time/tz/src"/>
<property name="conf.home" value="${source}/conf"/>
<property name="test.home" value="${source}/test/java"/>
<!-- The base directory for example sources -->
<property name="example.home" value="src/example"/>
<!-- The base directory for compilation targets -->
<property name="build" value="build"/>
<property name="build.conf" value="${build}/conf"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.tz" value="${build.classes}/org/joda/time/tz/data"/>
<property name="build.tests" value="${build}/tests"/>
<property name="build.docs" value="${build}/docs"/>
<property name="build.sources" value="${build}/sources"/>
<property name="build.javadoc" value="${build}/javadoc"/>
<property name="build.dist" value="${build}/dist"/>
<property name="build.fullname" value="${build}/${component.fullname}"/>
<property name="build.dist.fullname" value="${build.dist}/${component.fullname}"/>
<property name="build.dist.src.fullname" value="${build.dist.fullname}-src"/>
<property name="build.dist.bundle" value="${build.dist.fullname}-bundle"/>
<property name="repo" value="${user.home}/.maven/repository" />
<!-- ========== Compiler Defaults ========================================= -->
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<property name="compile.debuglevel" value="lines,source"/>
<!-- Should Java compilations set the 'deprecation' compiler option? -->
<property name="compile.deprecation" value="false"/>
<!-- Should Java compilations set the 'optimize' compiler option? -->
<property name="compile.optimize" value="true"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${jodaconvert.jar}"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${build.tests}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${jodaconvert.jar}"/>
</path>
<!-- Should all tests fail if one does? -->
<property name="test.failonerror" value="true"/>
<!-- The test runner to execute -->
<property name="test.runner" value="junit.textui.TestRunner"/>
<!-- ====================================================================== -->
<!-- ========== Executable Targets ======================================== -->
<!-- ====================================================================== -->
<target name="clean"
description="Clean build and distribution directories">
<delete dir="${build}"/>
</target>
<!-- ====================================================================== -->
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="-------- ${component.name} ${component.version} --------"/>
<filter token="name" value="${component.name}"/>
<filter token="package" value="${component.package}"/>
<filter token="version" value="${component.version}"/>
<available property="junit.ant" classname="junit.framework.Test"/>
<available property="junit.present" file="${junit.jar}"/>
<available property="jodaconvert.present" file="${jodaconvert.jar}"/>
<uptodate property="tz.build.notneeded" targetfile="${build.tz}/ZoneInfoMap" >
<srcfiles dir= "${source.tz}" includes="**/*.*"/>
</uptodate>
</target>
<!-- ====================================================================== -->
<target name="getjunit" unless="junit.present">
<echo message="Getting junit from http://repo2.maven.org/maven2/junit/junit/3.8.2"/>
<setproxy />
<mkdir dir="${lib}"/>
<get dest="${junit.jar}" usetimestamp="true" ignoreerrors="true" src="http://repo2.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar" />
</target>
<target name="getjodaconvert" unless="jodaconvert.present">
<echo message="Getting joda-convert from http://repo1.maven.org/maven2/org/joda/joda-convert/1.1"/>
<setproxy />
<mkdir dir="${lib}"/>
<get dest="${jodaconvert.jar}" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/org/joda/joda-convert/1.1/joda-convert-1.1.jar" />
</target>
<!-- ====================================================================== -->
<target name="installjunit" unless="junit.ant">
<echo message="Installing junit in ${ant.home}/lib"/>
<copy file="${junit.jar}" todir="${ant.home}/lib" />
<echo message="***************************************************************"/>
<echo message="* A copy of junit has been installed in your ant directory *"/>
<echo message="* *"/>
<echo message="* You will need to restart the ant build to pickup the change *"/>
<echo message="***************************************************************"/>
<fail message="Please restart ant"/>
</target>
<!-- ====================================================================== -->
<target name="prepare" depends="init,getjunit,installjunit,getjodaconvert"
description="Prepare build directory">
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.conf}"/>
</target>
<!-- ====================================================================== -->
<target name="static" depends="prepare"
description="Copy static files to build directory">
<tstamp/>
<copy todir="${build.conf}" filtering="on">
<fileset dir="${conf.home}" includes="*.MF"/>
</copy>
</target>
<!-- ====================================================================== -->
<target name="compile" depends="compile.main,compile.zoneinfo"
description="Compile shareable components">
</target>
<target name="compile.main" depends="static"
description="Compile main datetime classes">
<javac srcdir="${source.home}"
destdir="${build.classes}"
debug="${compile.debug}"
debuglevel="${compile.debuglevel}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
source="1.5" target="1.5" includeantruntime="false">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${source.home}" includes="**/*.properties"/>
</copy>
</target>
<!-- ====================================================================== -->
<target name="compile.zoneinfo"
depends="compile.main"
description="Compile timezone data files"
unless="tz.build.notneeded">
<!-- Invoke the newly built ZoneInfoCompiler to compile the zoneinfo data files -->
<mkdir dir="${build.tz}" />
<java classname="org.joda.time.tz.ZoneInfoCompiler"
fork="true"
failonerror="true">
<classpath path="${build.classes}" />
<!-- Override default provider since data directory doesn't exist yet -->
<sysproperty key="org.joda.time.DateTimeZone.Provider"
value="org.joda.time.tz.UTCProvider" />
<!-- Specify source and destination directories -->
<arg line="-src ${source.tz} -dst ${build.tz}" />
<!-- Specify all the data files to compile -->
<arg value="africa" />
<arg value="antarctica" />
<arg value="asia" />
<arg value="australasia" />
<arg value="europe" />
<arg value="northamerica" />
<arg value="southamerica" />
<arg value="pacificnew" />
<arg value="etcetera" />
<arg value="backward" />
<arg value="systemv" />
</java>
</target>
<!-- ====================================================================== -->
<target name="compile.tests" depends="compile"
description="Compile unit test cases">
<mkdir dir="${build.tests}"/>
<javac srcdir="${test.home}"
destdir="${build.tests}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}" includeantruntime="false">
<classpath refid="test.classpath"/>
</javac>
<copy todir="${build.tests}" filtering="on">
<fileset dir="${test.home}" excludes="**/*.java"/>
</copy>
</target>
<!-- ====================================================================== -->
<target name="all" depends="clean,compile"
description="Clean and compile all components"/>
<!-- ====================================================================== -->
<target name="javadoc" depends="compile"
description="Create component Javadoc documentation">
<mkdir dir="${build.docs}"/>
<javadoc sourcepath="${source.home}"
destdir="${build.docs}"
packagenames="org.joda.time.*"
author="true"
private="false"
package="false"
version="true"
use="yes"
splitindex="yes"
doctitle="<h1>${component.title}</h1>"
windowtitle="${component.title} (Version ${component.version})"
bottom="Copyright (c) 2001-2006 - Joda.org"
Overview="${source.home}/org/joda/time/overview.html">
<classpath refid="compile.classpath"/>
<group title="User Packages" packages="org.joda.time:org.joda.time.format:org.joda.time.chrono">
</group>
<group title="Implementation Packages" packages="org.joda.time.base:org.joda.time.convert:org.joda.time.field:org.joda.time.tz">
</group>
</javadoc>
</target>
<!-- ====================================================================== -->
<target name="jar" depends="compile"
description="Create jar">
<mkdir dir="${build.classes}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${build.classes}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.classes}/META-INF/NOTICE.txt"/>
<jar jarfile="${build.fullname}.jar"
basedir="${build.classes}"
manifest="${build.conf}/MANIFEST.MF"/>
</target>
<!-- ====================================================================== -->
<target name="javadoc.jar">
<mkdir dir="${build.javadoc}"/>
<copy todir="${build.javadoc}">
<fileset dir="${build.docs}" includes="**/*" />
</copy>
<mkdir dir="${build.javadoc}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${build.javadoc}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.javadoc}/META-INF/NOTICE.txt"/>
<jar jarfile="${build.fullname}-javadoc.jar"
basedir="${build.javadoc}" />
</target>
<!-- ====================================================================== -->
<target name="sources.jar">
<mkdir dir="${build.sources}"/>
<copy todir="${build.sources}">
<fileset dir="${source.home}" includes="**/*.java" />
</copy>
<mkdir dir="${build.sources}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${build.sources}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.sources}/META-INF/NOTICE.txt"/>
<jar jarfile="${build.fullname}-sources.jar"
basedir="${build.sources}" />
</target>
<!-- ====================================================================== -->
<target name="dist" depends="compile,jar,test.jar,javadoc,javadoc.jar,sources.jar"
description="Create binary distribution">
<!-- binary -->
<delete dir="${build.dist.fullname}"/>
<mkdir dir="${build.dist.fullname}"/>
<copy file="LICENSE.txt" todir="${build.dist.fullname}"/>
<copy file="NOTICE.txt" todir="${build.dist.fullname}"/>
<copy file="RELEASE-NOTES.txt" todir="${build.dist.fullname}"/>
<copy file="${build.fullname}.jar"
todir="${build.dist.fullname}"/>
<copy file="${build.fullname}-sources.jar"
todir="${build.dist.fullname}"/>
<copy file="${build.fullname}-javadoc.jar"
todir="${build.dist.fullname}"/>
<fixcrlf srcdir="${build.dist.fullname}" eol="lf" includes="*.txt"/>
<tar destfile="${build.fullname}.tar" basedir="${build.dist}"/>
<gzip zipfile="${build.fullname}.tar.gz" src="${build.fullname}.tar"/>
<delete file="${build.fullname}.tar"/>
<fixcrlf srcdir="${build.dist.fullname}" eol="crlf" includes="*.txt"/>
<zip destfile="${build.fullname}.zip" basedir="${build.dist}"/>
<delete dir="${build.dist.fullname}"/>
<!-- source -->
<delete dir="${build.dist.src.fullname}"/>
<mkdir dir="${build.dist.src.fullname}"/>
<copy file="LICENSE.txt" todir="${build.dist.src.fullname}"/>
<copy file="NOTICE.txt" todir="${build.dist.src.fullname}"/>
<copy file="RELEASE-NOTES.txt" todir="${build.dist.src.fullname}"/>
<copy file="${build.fullname}.jar"
todir="${build.dist.src.fullname}"/>
<copy todir="${build.dist.src.fullname}">
<fileset dir="." includes="${source}/**/*" excludes="CVS/**/*"/>
</copy>
<copy todir="${build.dist.src.fullname}">
<fileset dir="." includes="${xdocs}/**/*" excludes="CVS/**/*"/>
</copy>
<delete dir="${build.dist.src.fullname}/src/tzdata"/>
<copy file="build.xml" todir="${build.dist.src.fullname}"/>
<copy file="pom.xml" todir="${build.dist.src.fullname}"/>
<copy file="checkstyle.xml" todir="${build.dist.src.fullname}"/>
<copy file="ToDo.txt" todir="${build.dist.src.fullname}"/>
<fixcrlf srcdir="${build.dist.src.fullname}" eol="lf" includes="*.txt,*.properties,*.xml"/>
<tar destfile="${build.fullname}-src.tar" basedir="${build.dist}"/>
<gzip zipfile="${build.fullname}-src.tar.gz" src="${build.fullname}-src.tar"/>
<delete file="${build.fullname}-src.tar"/>
<fixcrlf srcdir="${build.dist.src.fullname}" eol="crlf" includes="*.txt,*.properties,*.xml"/>
<zip destfile="${build.fullname}-src.zip" basedir="${build.dist}"/>
<delete dir="${build.dist.src.fullname}"/>
<!-- bundle -->
<delete dir="${build.dist.bundle}"/>
<mkdir dir="${build.dist.bundle}"/>
<copy file="LICENSE.txt" todir="${build.dist.bundle}"/>
<copy file="NOTICE.txt" todir="${build.dist.bundle}"/>
<copy file="pom.xml" todir="${build.dist.bundle}"/>
<copy file="${build.fullname}.jar"
todir="${build.dist.bundle}"/>
<copy file="${build.fullname}-sources.jar"
todir="${build.dist.bundle}"/>
<copy file="${build.fullname}-javadoc.jar"
todir="${build.dist.bundle}"/>
<fixcrlf srcdir="${build.dist.bundle}" eol="crlf" includes="*.txt"/>
<jar jarfile="${build.fullname}-bundle.jar" basedir="${build.dist.bundle}"/>
<delete dir="${build.dist.bundle}"/>
</target>
<!-- ====================================================================== -->
<target name="test" depends="compile.tests, test.time"
description="Run all unit test cases">
</target>
<target name="test.time" depends="compile.tests,compile.zoneinfo">
<echo message="Running time tests ..."/>
<junit printsummary="yes" haltonfailure="yes">
<formatter type="plain" usefile="false" />
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${build.tests}"/>
<pathelement location="${build.tz}"/>
<pathelement location="${jodaconvert.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${test.home}">
<include name="**/TestAll.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- don't depend on jar, so we can test jar built on another JDK version -->
<target name="test.jar" depends="compile.tests">
<echo message="Running time tests from jar ..."/>
<junit printsummary="yes" haltonfailure="yes">
<formatter type="plain" usefile="false" />
<classpath>
<pathelement location="${build.fullname}.jar"/>
<pathelement location="${build.tests}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${jodaconvert.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${test.home}">
<include name="**/TestAll.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="clirr" depends="jar" description="clirr binary compatibility">
<echo message="${repo}/clirr/jars/clirr-core-0.6-uber.jar"></echo>
<taskdef classpath="${repo}/clirr/jars/clirr-core-0.6-uber.jar"
resource="clirrtask.properties"/>
<clirr>
<origfiles dir="${repo}/${component.name}/jars" includes="${component.name}-${previous.version}.jar"/>
<newfiles dir="." includes="${build.fullname}.jar"/>
<formatter type="xml" outfile="build/clirr.xml" />
</clirr>
</target>
<!--property name="emma.dir" value="${lib}" />
<path id="emma.lib" >
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
<target name="emma" description="turns on EMMA's on-the-fly instrumentation mode" >
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<property name="emma.enabled" value="true" />
</target-->
</project>