forked from apache/commons-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
597 lines (477 loc) · 24.1 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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Validator" default="dist" basedir=".">
<!--
"Validator" component of the Jakarta Commons Subproject
$Id$
$Rev$ $Date$
-->
<!-- ========== Initialize Properties ===================================== -->
<property file="build.properties"/> <!-- Component local -->
<property file="../build.properties"/> <!-- Commons local -->
<property file="${user.home}/build.properties"/> <!-- User local -->
<!-- ========== External Dependencies ===================================== -->
<!-- The directories corresponding to your necessary dependencies -->
<property name="junit.home" value="/usr/local/junit3.8.1"/>
<property name="commons.home" value="../../jakarta-commons"/>
<property name="sandbox.home" value="../../jakarta-commons-sandbox"/>
<property name="beanutils.home" value="${commons.home}/beanutils"/>
<property name="collections.home" value="${commons.home}/collections"/>
<property name="digester.home" value="${commons.home}/digester"/>
<property name="logging.home" value="${commons.home}/logging"/>
<!-- ========== Derived Values ============================================ -->
<!-- The locations of necessary jar files -->
<property name="junit.jar" value="${junit.home}/junit.jar"/>
<property name="commons-beanutils.jar" value="${beanutils.home}/dist/commons-beanutils.jar"/>
<property name="commons-digester.jar" value="${digester.home}/dist/commons-digester.jar"/>
<property name="commons-logging.jar" value="${logging.home}/dist/commons-logging.jar"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="validator"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.validator"/>
<!-- The title of this component -->
<property name="component.title" value="Validator"/>
<!-- The current version number of this component -->
<property name="component.version" value="1.3.2-SNAPSHOT"/>
<!-- The base directory for compilation targets -->
<property name="build.home" value="target"/>
<!-- The base directory for component configuration files -->
<property name="conf.home" value="conf/share"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="dist"/>
<!-- The base directory for release targets -->
<property name="release.home" value="release" />
<!-- The base directory for component sources -->
<property name="source.home" value="src/share"/>
<!-- The base directory for javascript sources -->
<property name="javascript.home" value="src/javascript"/>
<!-- The base directory for unit test sources -->
<property name="test.home" value="src/test"/>
<!-- The base directory for example sources -->
<property name="example.home" value="src/example"/>
<!-- Directory where binary release files are staged -->
<property name="stage.bin.dir" value="${release.home}/stage/bin"/>
<!-- Directory where source release files are staged -->
<property name="stage.src.dir" value="${release.home}/stage/src"/>
<!-- Directory where release builds are prepared for upload -->
<property name="upload.dir" value="${release.home}/upload"/>
<!-- Base file name for upload files -->
<property name="upload.file.base" value="${component.name}-${component.version}"/>
<!-- Download lib dir -->
<property name="download.lib.dir" value="lib"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- source JDK version (should be same as maven.compile.source) -->
<property name="compile.source" value="1.3"/>
<!-- target JDK version (should be same as maven.compile.target) -->
<property name="compile.target" value="1.3"/>
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<!-- 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.home}/classes"/>
<pathelement location="${commons-beanutils.jar}"/>
<pathelement location="${commons-digester.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${oro.jar}"/>
<path refid="downloaded.lib.classpath"/>
</path>
<!-- Construct compile classpath -->
<path id="downloaded.lib.classpath">
<pathelement location="${download.lib.dir}/commons-beanutils.jar"/>
<pathelement location="${download.lib.dir}/commons-digester.jar"/>
<pathelement location="${download.lib.dir}/commons-logging.jar"/>
<pathelement location="${download.lib.dir}/oro.jar"/>
<pathelement location="${download.lib.dir}/junit.jar"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/tests"/>
<pathelement location="${commons-beanutils.jar}"/>
<pathelement location="${commons-digester.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${oro.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${xerces.jar}"/>
<path refid="downloaded.lib.classpath"/>
</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"/>
<!-- ========== Example Execution Defaults ================================ -->
<!-- Construct example classpath -->
<path id="example.classpath">
<path refid="test.classpath"/>
<pathelement location="${build.home}/example" />
</path>
<!-- ========== Executable Targets ======================================== -->
<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}"/>
<filter token="compilesource" value="${compile.source}"/>
<filter token="compiletarget" value="${compile.target}"/>
<available property="jsdoc.found" type="file" file="${jsdoc.home}/jsdoc.pl"/>
<available file="${dojo_custom_rhino.jar}" property="dojo.found"/>
</target>
<target name="prepare" depends="init,download-dependencies"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/conf"/>
<mkdir dir="${build.home}/tests"/>
</target>
<target name="static" depends="prepare"
description="Copy static files to build directory">
<tstamp/>
<copy todir="${build.home}/conf" filtering="on">
<fileset dir="${conf.home}" includes="*.MF"/>
</copy>
</target>
<target name="compile" depends="static"
description="Compile shareable components">
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
source="${compile.source}"
target="${compile.target}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${build.home}/classes" filtering="on">
<fileset dir="${source.home}"
excludes="**/*.java"/>
</copy>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_0.dtd"/>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_0_1.dtd"/>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_1.dtd"/>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_1_3.dtd"/>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_2_0.dtd"/>
<copy todir="${build.home}/classes/org/apache/commons/validator/resources/"
file="${conf.home}/validator_1_3_0.dtd"/>
<copy todir="${build.home}/classes/">
<fileset dir="${javascript.home}"
includes="**/*.js"/>
</copy>
</target>
<target name="clean"
description="Clean build and distribution directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
<delete dir="${release.home}"/>
</target>
<target name="all" depends="clean,compile"
description="Clean and compile all components"/>
<target name="javadoc.init"
description="Initializes Javadoc directories">
<mkdir dir="${dist.home}"/>
<mkdir dir="${dist.home}/docs"/>
<mkdir dir="${dist.home}/docs/apidocs"/>
<mkdir dir="${dist.home}/docs/javascript"/>
<mkdir dir="${dist.home}/docs/javascript/org/apache/commons/validator/javascript/doc-files"/>
</target>
<target name="javadoc.js" depends="javadoc.js.unix,javadoc.js.windows"
description="Create Javascript Javadoc documentation">
<copy todir="${dist.home}/docs/javascript/org/apache/commons/validator/javascript/doc-files">
<fileset dir="${javascript.home}/org/apache/commons/validator/javascript/doc-files" includes="*.gif"/>
</copy>
</target>
<target name="javadoc.js.unix" depends="javadoc.init" if="jsdoc.found"
description="Create Javascript Javadoc documentation">
<exec executable="bash" failifexecutionfails="false">
<arg line="-c 'etc/jsdoc.sh ${jsdoc.home} ${javascript.home} ${dist.home}/docs/javascript' "/>
</exec>
</target>
<target name="javadoc.js.windows" depends="javadoc.init" if="jsdoc.found"
description="Windows Create Javascript Javadoc documentation">
<exec executable="etc/jsdoc.bat" failifexecutionfails="false">
<arg line="${jsdoc.home} ${javascript.home} ${dist.home}/docs/javascript"/>
</exec>
</target>
<target name="javadoc" depends="compile, javadoc.js"
description="Create component Javadoc documentation">
<javadoc sourcepath="${source.home}"
destdir="${dist.home}/docs/apidocs"
packagenames="org.apache.commons.*"
author="true"
private="true"
version="true"
doctitle="<h1>${component.title} (Version ${component.version})</h1>"
windowtitle="${component.title} (Version ${component.version})"
bottom="Copyright (c) 2001-2004 Apache Software Foundation"
classpathref="compile.classpath" />
</target>
<target name="change-log" >
<cvschangelog destfile="changelog.xml" start="${cvs.start}" />
<style in="changelog.xml" out="changelog.html" style="${ant.home}/etc/changelog.xsl">
<param name="title" expression="Validator ChangeLog"/>
<param name="module" expression="commons"/>
<param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
</style>
</target>
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
<mkdir dir="${dist.home}"/>
<!-- Create Single file of static JavaScript -->
<concat destfile="${dist.home}/commons-${component.name}-${component.version}.js">
<fileset dir="${javascript.home}/org/apache/commons/validator/javascript" includes="*.js"/>
</concat>
<!-- Create compressed javascript versions -->
<antcall target="compress.javascript"/>
<copy file="LICENSE.txt"
todir="${dist.home}"/>
<copy file="NOTICE.txt"
todir="${dist.home}"/>
<copy file="RELEASE-NOTES.txt"
todir="${dist.home}"/>
<mkdir dir="${build.home}/classes/META-INF"/>
<copy file="LICENSE.txt"
tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
<jar jarfile="${dist.home}/commons-${component.name}-${component.version}.jar"
basedir="${build.home}/classes"
manifest="${build.home}/conf/MANIFEST.MF"/>
</target>
<target name="compress.javascript" if="dojo_custom_rhino.jar">
<antcall target="dojo.compress">
<param name="jsfilename" value="${dist.home}/commons-${component.name}-${component.version}"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateByte"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateCreditCard"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateDate"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateEmail"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateFloat"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateFloatRange"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateInteger"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateIntRange"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMask"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMaxLength"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateMinLength"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateRequired"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateShort"/>
</antcall>
<antcall target="dojo.compress">
<param name="jsfilename" value="${build.home}/classes/org/apache/commons/validator/javascript/validateUtilities"/>
</antcall>
</target>
<target name="dojo.compress">
<java jar="${dojo_custom_rhino.jar}" fork="true"
output="${jsfilename}-compress.js">
<arg value="-c"/>
<arg value="${jsfilename}.js"/>
</java>
</target>
<!-- ========== Unit Test Targets ========================================= -->
<target name="compile.tests" depends="compile"
description="Compile unit test cases">
<javac srcdir="${test.home}"
destdir="${build.home}/tests"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
</javac>
<copy todir="${build.home}/tests" filtering="on">
<fileset dir="${test.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="test" depends="compile.tests,test.main,test.routines"
description="Run all unit test cases">
</target>
<target name="test.main" depends="compile.tests"
description="Run main unit test cases">
<echo message="Running main tests ..."/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<arg value="org.apache.commons.validator.ValidatorTestSuite"/>
<classpath refid="test.classpath"/>
</java>
</target>
<target name="test.routines" depends="compile.tests"
description="Run routines unit test cases">
<echo message="Running routines tests ..."/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<arg value="org.apache.commons.validator.routines.RoutinesTestSuite"/>
<classpath refid="test.classpath"/>
</java>
</target>
<!-- ========== Example Targets =========================================== -->
<target name="prepare.example" depends="compile"
description="Prepare example directory">
<mkdir dir="${build.home}/example"/>
</target>
<target name="compile.example" depends="prepare.example"
description="Compile example application">
<javac srcdir="${example.home}"
destdir="${build.home}/example"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="example.classpath"/>
</javac>
<copy todir="${build.home}/example" filtering="on">
<fileset dir="${example.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="example" depends="compile.example,compile.tests"
description="Run example application">
<java fork="yes"
classname="org.apache.commons.validator.example.ValidateExample"
taskname="main" failonerror="true">
<classpath refid="example.classpath" />
</java>
</target>
<!-- ========== Release Targets =========================================== -->
<target name="release" depends="clean,dist"
description="Construct release distribution">
<mkdir dir="${stage.bin.dir}/${upload.file.base}"/>
<mkdir dir="${stage.src.dir}/${upload.file.base}-src"/>
<copy todir="${stage.bin.dir}/${upload.file.base}">
<fileset dir="${dist.home}"/>
</copy>
<copy todir="${stage.src.dir}/${upload.file.base}-src">
<fileset dir=".">
<exclude name="build.properties"/>
<exclude name="${build.home}/**"/>
<exclude name="${dist.home}/**"/>
<exclude name="${build.home}/**"/>
</fileset>
</copy>
<mkdir dir="${upload.dir}"/>
<zip zipfile="${upload.dir}/${upload.file.base}.zip"
basedir="${stage.bin.dir}"/>
<zip zipfile="${upload.dir}/${upload.file.base}-src.zip"
basedir="${stage.src.dir}"/>
<tar tarfile="${upload.dir}/${upload.file.base}.tar"
basedir="${stage.bin.dir}"
longfile="gnu"/>
<tar tarfile="${upload.dir}/${upload.file.base}-src.tar"
basedir="${stage.src.dir}"
longfile="gnu"/>
<gzip src="${upload.dir}/${upload.file.base}.tar"
zipfile="${upload.dir}/${upload.file.base}.tar.gz"/>
<gzip src="${upload.dir}/${upload.file.base}-src.tar"
zipfile="${upload.dir}/${upload.file.base}-src.tar.gz"/>
</target>
<!-- ========== Download Dependencies =========================================== -->
<target name="download-dependencies"
depends="check-availability, check-dojo-lib" unless="skip.download">
<echo message="doing download-dependencies..." />
<antcall target="download-beanutils" />
<antcall target="download-digester" />
<antcall target="download-logging" />
<antcall target="download-oro" />
<antcall target="download-junit" />
<antcall target="download-dojo-compress" />
</target>
<target name="check-availability">
<echo message="doing check-availability..." />
<available file="${commons-beanutils.jar}" property="beanutils.found"/>
<available file="${commons-digester.jar}" property="digester.found"/>
<available file="${commons-logging.jar}" property="logging.found"/>
<available file="${oro.jar}" property="oro.found"/>
<available file="${junit.jar}" property="junit.found"/>
<available file="${dojo_custom_rhino.jar}" property="dojo.found"/>
</target>
<target name="check-dojo-lib" unless="dojo.found">
<echo message="doing check-dojo-lib..." />
<available file="${download.lib.dir}/custom_rhino.jar" property="dojo.found"/>
<property name="dojo_custom_rhino.jar" value="${download.lib.dir}/custom_rhino.jar"/>
</target>
<target name="download-beanutils" unless="beanutils.found">
<echo message="Downloading beanutils..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-beanutils.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-beanutils/jars/commons-beanutils-1.7.0.jar"/>
</target>
<target name="download-digester" unless="digester.found">
<echo message="Downloading digester..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-digester.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-digester/jars/commons-digester-1.6.jar"/>
</target>
<target name="download-logging" unless="logging.found">
<echo message="Downloading logging..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-logging.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.3.jar"/>
</target>
<target name="download-oro" unless="oro.found">
<echo message="Downloading oro..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/oro.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/oro/jars/oro-2.0.8.jar"/>
</target>
<target name="download-junit" unless="junit.found">
<echo message="Downloading junit..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/junit.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar"/>
</target>
<target name="download-dojo-compress" unless="dojo.found">
<mkdir dir="${download.lib.dir}" />
<echo message="Downloading dojo compress...."/>
<get dest="${download.lib.dir}/custom_rhino.jar"
usetimestamp="true" ignoreerrors="true"
src="http://dojotoolkit.org/svn/dojo/trunk/buildscripts/lib/custom_rhino.jar"/>
</target>
</project>