forked from ThreeTen/threeten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
423 lines (372 loc) · 18.3 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
<!--
Ant Build for ThreeTen
@author Fabio Kung (fabio.kung@gmail.com)
@author Michael Nascimento Santos
@author Oliver Fischer (o.b.fischer@swe-blog.net)
@author Stephen Colebourne
@author Richard Warburton
@author Benjamin Graf
-->
<project name="threeten" default="dist">
<description>
ThreeTen date and time API, reference implementation for JSR 310
</description>
<property file="build.properties" />
<property file="version.properties"/>
<tstamp />
<property name="maven" value="${dist}/maven" />
<property name="jarBase" value="threeten-${version.full}" />
<property name="jarName" value="${jarBase}.jar" />
<property name="jarNameSources" value="${jarBase}-sources.jar" />
<property name="jarNameJavadoc" value="${jarBase}-javadoc.jar" />
<property name="jarNamePom" value="${jarBase}.pom" />
<property name="jarCoreName" value="threeten-core-${version.full}.jar" />
<property name="distFileName" value="threeten-${version.full}.zip"/>
<property name="tzdbBase" value="jsr-310-TZDB-all-${version.full}" />
<property name="tzdbJarName" value="${tzdbBase}.jar" />
<property name="tzdbJarNamePom" value="${tzdbBase}.pom" />
<macrodef name="get-dependency">
<attribute name="group" />
<attribute name="artifact" />
<attribute name="version" />
<attribute name="variant" default="" />
<attribute name="dest" />
<sequential>
<get
src="${maven.repo.url}/@{group}/@{artifact}/@{version}/@{artifact}-@{version}@{variant}.jar"
dest="@{dest}/@{artifact}-@{version}@{variant}.jar"
verbose="true"
usetimestamp="true" ignoreerrors="true"/>
</sequential>
</macrodef>
<path id="main.path">
<pathelement location="${core.main.classes}" />
<pathelement location="${lib.main}/${tzdb.outputjar}"/>
</path>
<path id="test.commonpath">
<pathelement location="${core.test.classes}" />
<pathelement location="${standard.test.classes}" />
<pathelement location="${lib.main}/${tzdb.outputjar}"/>
<fileset dir="lib/test">
<include name="**/*.jar" />
</fileset>
</path>
<path id="test.path">
<path refid="main.path" />
<path refid="test.commonpath" />
</path>
<path id="tck.path">
<pathelement location="${tck.implementation}" />
<path refid="test.commonpath" />
</path>
<property name="tck.groups" value="tck" />
<path id="coverage.path">
<pathelement location="${core.main.classes}" />
<pathelement location="${core.test.classes}" />
<pathelement location="${standard.test.classes}" />
<pathelement location="${lib.main}/${tzdb.outputjar}"/>
<fileset dir="lib/test">
<include name="**/*.jar" />
</fileset>
</path>
<path id="emma.lib" >
<pathelement location="${lib.coverage}/emma-2.0.5312.jar" />
<pathelement location="${lib.coverage}/emma_ant-2.0.5312.jar" />
</path>
<!-- ==================================================================== -->
<target name="resolve-deps">
<mkdir dir="${lib.main}" />
<mkdir dir="${lib.optional}" />
<mkdir dir="${lib.test}" />
<mkdir dir="${lib.coverage}" />
<get-dependency group="org/testng" artifact="testng" version="5.8" variant="-jdk15" dest="${lib.test}" />
<get-dependency group="emma" artifact="emma" version="2.0.5312" dest="${lib.coverage}" />
<get-dependency group="emma" artifact="emma_ant" version="2.0.5312" dest="${lib.coverage}" />
</target>
<target name="init" depends="resolve-deps">
</target>
<target name="clean" description="clean up">
<delete dir="${build}" />
<delete dir="${dist}" />
<!--delete dir="${lib.main}" failonerror="false" /-->
<delete dir="${lib.optional}" failonerror="false" />
</target>
<!-- ==================================================================== -->
<target name="compile-core" depends="init">
<mkdir dir="${core.main.classes}"/>
<javac srcdir="${core.main}" destdir="${core.main.classes}" debug="true" includeantruntime="false">
<classpath refid="main.path"/>
<!--compilerarg value="-Xlint" /-->
</javac>
<copy todir="${core.main.classes}">
<fileset dir="${core.main.resources}" />
</copy>
</target>
<!-- target to test if existing tzdb is out of date with respect to the input tzdb files -->
<target name="check-tzdb">
<dependset>
<srcfileset
dir="${tzdata.main}"
includes="tzdata*.tar.gz" />
<targetfilelist
dir="${lib.main}"
files="${tzdb.outputjar}" />
</dependset>
<available property="tzdb.available"
file="${lib.main}/${tzdb.outputjar}" />
</target>
<target name="compile-tzdb" depends="check-tzdb,compile-core" unless="tzdb.available">
<antcall target="force-compile-tzdb"/>
</target>
<target name="force-compile-tzdb" depends="compile-core">
<mkdir dir="${tzdata.main.workarea}"/>
<copy todir="${tzdata.main.workarea}">
<fileset dir="${tzdata.main}" includes="tzdata*.tar.gz"/>
<mapper type="glob" from="tzdata*.tar.gz" to="*/tzdb.tar.gz" />
</copy>
<subant genericantfile="build.xml" target="tzdb-unpack">
<dirset dir="${tzdata.main.workarea}" includes="*" />
</subant>
<java classpathref="main.path" classname="javax.time.zone.TZDBZoneRulesCompiler" fork="true" failonerror="true">
<arg line="-srcdir ${tzdata.main.workarea}" />
<arg line="-dstdir ${lib.optional}" />
<arg line="${tzdb.files}" />
</java>
<copy todir="${lib.main}">
<fileset dir="${lib.optional}" includes="${tzdb.outputjar}"/>
</copy>
<delete file="${lib.optional}/${tzdb.outputjar}" />
</target>
<target name="tzdb-unpack">
<echo message="${basedir}"></echo>
<gunzip src="${basedir}/tzdb.tar.gz" />
<untar src="${basedir}/tzdb.tar" dest="${basedir}" />
<delete file="${basedir}/tzdb.tar" />
</target>
<target name="compile" depends="compile-core, compile-tzdb" description="compile all sources" />
<!-- ==================================================================== -->
<target name="javadoc" depends="init" description="generates javadoc for the api">
<mkdir dir="${build.javadoc}"/>
<javadoc sourcepath="${core.main}" destdir="${build.javadoc}"
group="Core javax.time:javax.time.calendrical:javax.time.builder:javax.time.format:javax.time.zone:javax.time.chrono:javax.time.chrono.global"
classpathref="main.path"
link="http://docs.oracle.com/javase/7/docs/api/"
stylesheetfile="${basedir}/stylesheet.css"
windowtitle="ThreeTen date and time API"
failonerror="true"
use="true"
packagenames="javax.time**/*,java.util**/*"
overview="${core.main}/javax/time/overview.html" />
</target>
<!-- ==================================================================== -->
<target name="run" description="Run the Usability program" depends="compile-core-tests,compile-standard-tests">
<java classname="javax.time.UsabilityChrono"
classpathref="test.path"/>
</target>
<!-- ==================================================================== -->
<target name="compile-core-tests" depends="compile">
<mkdir dir="${core.test.classes}" />
<javac srcdir="${core.test}" destdir="${core.test.classes}" classpathref="test.path" debug="true" includeantruntime="false" />
<javac srcdir="${core.tck}" destdir="${core.test.classes}" classpathref="test.path" debug="true" includeantruntime="false" />
</target>
<target name="compile-standard-tests" depends="compile">
<mkdir dir="${standard.test.classes}" />
<javac srcdir="${standard.test}" destdir="${standard.test.classes}" classpathref="test.path" debug="true" includeantruntime="false" />
</target>
<target name="test-core" depends="compile-core-tests">
<taskdef resource="testngtasks" classpathref="test.path" />
<testng classpathref="test.path" outputDir="${core.test.classes}" sourceDir="${core.test}" haltonfailure="true" verbose="2">
<jvmarg value="-Xmx512M" />
<jvmarg value="-Duser.language=en" />
<jvmarg value="-Duser.country=UK" />
<classfileset dir="${core.test.classes}" includes="**/Test*.class" excludes="java/util/*" />
<classfileset dir="${core.test.classes}" includes="**/TCKX*.class" excludes="java/util/*" />
</testng>
</target>
<target name="test-standard" depends="compile-standard-tests">
<taskdef resource="testngtasks" classpathref="test.path" />
<testng classpathref="test.path" outputDir="${standard.test.classes}" sourceDir="${standard.test}" haltonfailure="true" verbose="2">
<jvmarg value="-Xmx512M" />
<jvmarg value="-Duser.language=en" />
<jvmarg value="-Duser.country=UK" />
<classfileset dir="${standard.test.classes}" includes="**/Test*.class" excludes="java/util/*" />
</testng>
</target>
<target name="test" depends="test-core,test-standard" description="run tests" />
<target name="check-sigtest-downloaded">
<available property="sigtest.exists" file="${sigtest.loc}"/>
</target>
<target name="download-sigtest" depends="check-sigtest-downloaded" unless="${sigtest.exists}">
<get
src="${sigtest.dist.origin}"
dest="${sigtest.dist.file}"
verbose="true"
usetimestamp="true" />
<unzip
src="${sigtest.dist.file}"
dest="${lib.test}">
<patternset>
<include name="${sigtest.dist.jarloc}" />
</patternset>
<mapper type="flatten"/>
</unzip>
<delete file="${sigtest.dist.file}" />
</target>
<target name="tdtck" description="Setup task definitions for the TCK" depends="download-sigtest" >
<taskdef name="setup-sigtest-task" classname="com.sun.tdk.signaturetest.ant.ASetup"
classpath="${sigtest.loc}"/>
<taskdef name="test-sigtest-task" classname="com.sun.tdk.signaturetest.ant.ATest"
classpath="${sigtest.loc}"/>
<property name="tck-signatures" value="${build.test}/jsr310.sig" />
<property name="tck-rt-jar" value="${java.home}/lib/rt.jar" />
</target>
<target name="setup-sigtest"
description="generates the signatures file from the reference implementation"
depends="tdtck">
<setup-sigtest-task package="javax.time" failonerror="true" apiVersion="openapi-v2"
filename="${tck-signatures}">
<classpath>
<pathelement location="${tck-rt-jar}"/>
<pathelement location="${build}/${jarName}"/>
</classpath>
<!--<exclude class="com.acme.openapi.NotTested"/>-->
</setup-sigtest-task>
</target>
<target name="run-sigtest"
description="compares the reference implementation sigtest results with a specified path"
depends="tdtck">
<test-sigtest-task failonerror="true" apiVersion="openapi-v2"
filename="${tck-signatures}" backward="true" output="st_report.txt">
<package name="javax.time" />
<!--<exclude class="com.acme.openapi.NotTested"/>-->
<classpath>
<pathelement location="${tck-rt-jar}"/>
<pathelement location="${tck.implementation}"/>
</classpath>
</test-sigtest-task>
</target>
<target name="runtck" depends="compile-core-tests" >
<taskdef resource="testngtasks" classpathref="tck.path" />
<testng classpathref="tck.path" outputDir="${core.test.classes}" sourceDir="${core.test}" haltonfailure="true" verbose="2" groups="tck">
<jvmarg value="-Xmx512M" />
<jvmarg value="-Duser.language=en" />
<jvmarg value="-Duser.country=UK" />
<classfileset dir="${core.test.classes}" includes="**/Test*.class" excludes="java/util/*" />
</testng>
</target>
<target name="tck" depends="compile-tzdb,runtck,run-sigtest" description="run tck acceptance criteria" />
<!-- ==================================================================== -->
<macrodef name="do-coverage">
<attribute name="runclass" />
<attribute name="htmlout" />
<attribute name="txtout" />
<sequential>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<mkdir dir="${build.coverage}" />
<emmajava libclasspathref="emma.lib"
fullmetadata="yes"
sourcepath="${core.main}"
classname="@{runclass}"
classpathref="coverage.path">
<jvmarg value="-Xmx512M" />
<jvmarg value="-XX:-UseSplitVerifier" />
<filter includes="javax.time.*" excludes="*Test*, *Mock*, *Performance*, *Examples*, *AllTCK*, *Usability*" />
<txt outfile="${build.coverage}/@{txtout}" />
<html outfile="${build.coverage}/@{htmlout}" metrics="method:90,block:90,line:90,class:95" />
</emmajava>
</sequential>
</macrodef>
<target name="tck-coverage" depends="compile-core-tests,compile-standard-tests" description="tck coverage">
<do-coverage runclass="javax.time.AllTCK" htmlout="tck.html" txtout="tck.txt" />
</target>
<target name="coverage" depends="compile-core-tests,compile-standard-tests" description="test coverage">
<do-coverage runclass="javax.time.AllTest" htmlout="coverage.html" txtout="coverage.txt" />
</target>
<!-- ==================================================================== -->
<target name="jar-main" depends="compile">
<jar jarfile="${build}/${jarName}">
<fileset dir="${core.main.classes}"/>
</jar>
</target>
<target name="jar-main-sources">
<jar jarfile="${build}/${jarNameSources}">
<fileset dir="${core.main}"/>
</jar>
</target>
<target name="jar-main-javadoc" depends="javadoc">
<jar jarfile="${build}/${jarNameJavadoc}">
<fileset dir="${build.javadoc}"/>
</jar>
</target>
<target name="jar" depends="jar-main,jar-main-sources,jar-main-javadoc" description="build jar files" />
<!-- ==================================================================== -->
<target name="dist" depends="jar" description="generate the distribution">
<copy todir="${dist.workarea}/${src}">
<fileset dir="${src}"/>
</copy>
<copy todir="${dist.workarea}/lib" flatten="true">
<fileset dir="${lib.main}" includes="${tzdb.outputjar}" />
<fileset dir="${build}" includes="${jarName}" />
</copy>
<copy todir="${dist.workarea}/lib-optional" flatten="true">
<fileset dir="${lib.optional}" includes="*.jar" />
<fileset dir="${build}" includes="*.jar" />
</copy>
<delete file="${dist.workarea}/lib-optional/${jarName}" />
<copy todir="${dist.workarea}/nbproject">
<fileset dir="nbproject"/>
</copy>
<copy file=".classpath" todir="${dist.workarea}" />
<copy file=".project" todir="${dist.workarea}" />
<copy file="build.xml" todir="${dist.workarea}" />
<copy file="build.properties" todir="${dist.workarea}" />
<copy file="checkstyle.xml" todir="${dist.workarea}" />
<copy file="LICENSE.txt" todir="${dist.workarea}" />
<copy file="README.txt" todir="${dist.workarea}" />
<copy file="TODO.txt" todir="${dist.workarea}" />
<zip destfile="${dist}/${distFileName}" basedir="${dist.workarea}" />
</target>
<target name="maven.clean">
<delete dir="${maven}" includes="**/*" failonerror="false"/>
</target>
<target name="maven" depends="maven.clean, dist">
<mkdir dir="${maven}"/>
<mkdir dir="${maven}/threeten"/>
<mkdir dir="${maven}/tzdb"/>
<copy todir="${maven}/threeten">
<fileset file="${build}/${jarName}"/>
<fileset file="${build}/${jarNameSources}"/>
<fileset file="${build}/${jarNameJavadoc}"/>
</copy>
<copy filtering="true" file="maven/threeten.pom" tofile="${maven}/threeten/${jarNamePom}">
<filterset>
<filter token="version" value="${version.full}"/>
</filterset>
</copy>
<copy file="${lib.main}/${tzdb.outputjar}" tofile="${maven}/tzdb/${tzdbJarName}"/>
<copy filtering="true" file="maven/jsr-310-TZDB-all.pom" tofile="${maven}/tzdb/${tzdbJarNamePom}">
<filterset>
<filter token="version" value="${version.full}"/>
</filterset>
</copy>
<checksum algorithm="sha1">
<fileset dir="${maven}/threeten"/>
<fileset dir="${maven}/tzdb"/>
</checksum>
<jar destfile="${maven}/${jarBase}-maven-bundle.jar" basedir="${maven}/threeten" includes="${jarBase}*"/>
<jar destfile="${maven}/${tzdbBase}-maven-bundle.jar" basedir="${maven}/tzdb" includes="${tzdbBase}*"/>
</target>
<target name="fixup" description="fixes code to OpenJdk standards">
<!-- this does NOT change line endings to unix -->
<fixcrlf srcdir="." includes="**/*.java" eof="remove" fixlast="true" tab="remove" tablength="4" javafiles="true" />
</target>
<target name="checkstyle" description="checkstyle to 310 standards">
<exec executable="checkstyle">
<arg line="-c checkstyle.xml -r ${core.main} -r ${core.test}"/>
</exec>
</target>
<!-- ==================================================================== -->
<target name="examples" depends="compile-core-tests,compile-standard-tests" description="outputs some examples to system out">
<java classname="javax.time.Examples" classpathref="test.path" fork="true"/>
</target>
</project>