-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
919 lines (774 loc) · 35.6 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
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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="velocity-tools" default="all" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<!-- ========== Properties ===================================== -->
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it -->
<property file="${user.home}/.ant.properties" />
<property file="${user.home}/build.properties" />
<property file=".ant.properties" />
<!-- This file contains all the defaults for building VelocityTools -->
<property file="build.properties"/> <!-- Component local -->
<!-- ========== Targets ======================================== -->
<!-- Main Target -->
<target name="all" depends="clean,jar.struts,examples,javadoc,docs,env"
description="Clean and build velocity-tools library, examples, and documentation."/>
<!-- Environment Target -->
<target name="env" description="Prints build parameters">
<echo>
Global settings:
java.home = ${java.home}
user.home = ${user.home}
java.class.path = ${java.class.path}
Project settings:
Version: ${project.id}
Debug: ${compile.debug}
Optimize: ${compile.optimize}
Deprecation: ${compile.deprecation}
Encoding: ${compile.encoding}
Build settings:
Source Files: ${source.home}
Build Files: ${build.dir}
Distribution Files: ${dist.dir}
</echo>
</target>
<!-- Clean Target -->
<target name="clean" description="Deletes the build, dist and docs directories">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${docs.dir}"/>
<delete dir="${mvn.build.dir}"/>
<!-- Clean example applications -->
<ant antfile="${basedir}/examples.xml" target="clean-examples" />
<!-- Clean tests -->
<ant antfile="${basedir}/test.xml" target="test.clean"/>
</target>
<!-- To do a truly, completely clean build, include this target -->
<target name="clean.lib"
description="Deletes the folder of downloaded dependencies">
<delete dir="${lib.dir}"/>
<ant antfile="${basedir}/test.xml" target="test.clean.lib"/>
</target>
<!-- Prepare Environment -->
<target name="prepare" depends="prepare.compile,prepare.docs,prepare.examples">
<echo message="-------- ${project.name} ${project.version} --------"/>
</target>
<!-- Prepare Compilation Environment -->
<target name="prepare.compile">
<!-- make necessary directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${lib.dir}" />
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}"/>
<!-- download dependency jars -->
<ant antfile="${basedir}/download.xml" target="compile-download" />
<!-- construct classpath of all jars in lib repository -->
<path id="compile.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
<!-- Prepare Documentation Environment -->
<target name="prepare.docs">
<!-- make necessary directories -->
<mkdir dir="${lib.dir}" />
<!-- download dependency jars -->
<ant antfile="${basedir}/download.xml" target="docs-download" />
<!-- construct classpath of all jars needed to build docs -->
<path id="docs.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
</target>
<!-- Prepare Examples Environment -->
<target name="prepare.examples">
<!-- download dependency jars -->
<ant antfile="${basedir}/download.xml" target="examples-download" />
</target>
<!-- Compile VelocityTools (all of it) -->
<target name="compile" depends="compile.struts"
description="Compiles the Velocity-Tools project (struts, view and generic)"/>
<!-- Compile VelocityStruts (struts, view, generic) -->
<target name="compile.struts" depends="prepare.compile"
description="Compiles the Velocity-Tools project (struts, view, and generic)">
<javac srcdir="${classes.src}"
debug="${compile.debug}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}"
deprecation="${compile.deprecation}"
encoding="${compile.encoding}"
destdir="${classes.dir}">
<classpath refid="compile.classpath" />
<include name="org/**"/>
</javac>
<copy todir="${classes.dir}" filtering="yes">
<fileset dir="${classes.src}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.tld"/>
</fileset>
</copy>
</target>
<!-- Compile Just VelocityView (view, generic) -->
<target name="compile.view" depends="prepare.compile"
description="Compiles VelocityView and the generic tools">
<javac srcdir="${classes.src}"
debug="${compile.debug}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}"
deprecation="${compile.deprecation}"
encoding="${compile.encoding}"
destdir="${classes.dir}">
<classpath refid="compile.classpath" />
<include name="org/**"/>
<exclude name="**/struts/**"/>
</javac>
<copy todir="${classes.dir}" filtering="yes">
<fileset dir="${classes.src}">
<include name="**/generic/*.properties"/>
<include name="**/generic/*.xml"/>
<include name="**/view/*.properties"/>
<include name="**/view/*.xml"/>
<include name="**/*.tld"/>
</fileset>
</copy>
</target>
<!-- Compile Just Generic Tools (generic) -->
<target name="compile.generic" depends="prepare.compile"
description="Compiles just the generic tools in this project">
<javac srcdir="${classes.src}"
debug="${compile.debug}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}"
deprecation="${compile.deprecation}"
encoding="${compile.encoding}"
destdir="${classes.dir}">
<classpath refid="compile.classpath" />
<include name="org/**"/>
<exclude name="**/struts/**"/>
<exclude name="**/view/**"/>
</javac>
<copy todir="${classes.dir}" filtering="yes">
<fileset dir="${classes.src}">
<include name="**/generic/*.properties"/>
<include name="**/generic/*.xml"/>
</fileset>
</copy>
</target>
<!-- Jar VelocityTools (struts, view, generic) -->
<target name="jar" depends="jar.struts"
description="Creates a velocity-tools jar in the dist directory."/>
<!-- Jar VelocityStruts (struts, view, generic) -->
<target name="jar.struts" depends="compile.struts"
description="Creates a velocity-tools jar in the dist directory.">
<jar jarfile="${dist.dir}/${struts.id}.jar">
<fileset dir="${classes.dir}"/>
<metainf dir="${basedir}">
<include name="LICENSE"/>
<include name="NOTICE"/>
</metainf>
<manifest>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Package" value="org.apache.velocity.tools"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="${struts.libname}"/>
<attribute name="Specification-Title" value="${struts.name} is ${struts.description}" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.velocity"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${project.version}"/>
</manifest>
</jar>
<checksum file="${dist.dir}/${struts.id}.jar" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${struts.id}.jar" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Jar Just VelocityView (view, generic) -->
<target name="jar.view" depends="compile.view"
description="Creates a velocity-tools-view jar in the dist directory">
<jar jarfile="${dist.dir}/${view.id}.jar">
<fileset dir="${classes.dir}">
<exclude name="**/struts/**"/>
</fileset>
<metainf dir="${basedir}">
<include name="LICENSE"/>
<include name="NOTICE"/>
</metainf>
<manifest>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Package" value="org.apache.velocity.tools"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="${view.libname}"/>
<attribute name="Specification-Title" value="${view.name} is ${view.description}" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.velocity"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${project.version}"/>
</manifest>
</jar>
<checksum file="${dist.dir}/${view.id}.jar" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${view.id}.jar" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Jar Just Generic Tools (generic) -->
<target name="jar.generic" depends="compile.generic"
description="Creates a velocity-tools-generic jar in the dist directory">
<jar jarfile="${dist.dir}/${generic.id}.jar">
<fileset dir="${classes.dir}">
<exclude name="**/struts/**"/>
<exclude name="**/view/**"/>
</fileset>
<metainf dir="${basedir}">
<include name="LICENSE"/>
<include name="NOTICE"/>
</metainf>
<manifest>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Package" value="org.apache.velocity.tools.generic"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="${generic.libname}"/>
<attribute name="Specification-Title" value="${generic.name} is ${generic.description}" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.velocity.tools"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${project.version}"/>
</manifest>
</jar>
<checksum file="${dist.dir}/${generic.id}.jar" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${generic.id}.jar" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Jar all source files (struts, view, generic) -->
<target name="jar.source" depends="prepare"
description="Builds a jar file of all the source classes">
<jar jarfile="${dist.dir}/${project.id}-src.jar">
<metainf dir="${basedir}">
<include name="LICENSE"/>
<include name="NOTICE"/>
</metainf>
<fileset dir="${source.home}"/>
<manifest>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Specification-Title" value="${struts.name} is ${struts.description}" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.velocity"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${project.version}"/>
</manifest>
</jar>
<checksum file="${dist.dir}/${project.id}-src.jar" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}-src.jar" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Build Javadocs (struts, view, generic) -->
<target name="javadoc" description="Builds Javadoc for the whole project.">
<mkdir dir="${javadoc.dir}" />
<javadoc packagenames="org.apache.velocity.tools.*"
destdir="${docs.dir}/javadoc"
author="true"
private="true"
version="true"
doctitle="<h1>${javadoc.title}</h1>"
windowtitle="${javadoc.title}"
bottom="Copyright (c) ${javadoc.year} Apache Software Foundation" >
<classpath refid="compile.classpath"/>
<sourcepath>
<pathelement path="${classes.src}" />
</sourcepath>
</javadoc>
</target>
<!-- Build Javadocs Jar (struts, view, generic) -->
<target name="jar.javadoc" depends="prepare,javadoc"
description="Builds a jar file with the javadoc for the whole project.">
<jar jarfile="${dist.dir}/${project.id}-javadoc.jar">
<metainf dir="${basedir}">
<include name="LICENSE"/>
<include name="NOTICE"/>
</metainf>
<fileset dir="${javadoc.dir}"/>
<manifest>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Specification-Title" value="${struts.name} is ${struts.description}" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.velocity"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${project.version}"/>
</manifest>
</jar>
<checksum file="${dist.dir}/${project.id}-javadoc.jar" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}-javadoc.jar" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Build JDocs (for jdocs.com) -->
<target name="jdocs" description="Builds JDocs for the whole project">
<taskdef name="jdocs" classname="com.dzone.jdocs.ant.jdk15.task.Jdocs"/>
<mkdir dir="${javadoc.dir}" />
<jdocs packagenames="org.apache.velocity.tools.*"
destdir="${docs.dir}/javadoc"
author="true"
private="true"
version="true"
doctitle="<h1>${javadoc.title}</h1>"
windowtitle="${javadoc.title}"
bottom="Copyright (c) ${javadoc.year} Apache Software Foundation" >
<classpath refid="compile.classpath"/>
<sourcepath>
<pathelement path="${classes.src}" />
</sourcepath>
</jdocs>
</target>
<!-- Build Velocity-Tools documentation -->
<target name="docs" depends="prepare.docs"
description="Generate documentation into ${docs.dir}">
<taskdef name="dvsl" classname="org.apache.dvsl.DVSLTask">
<classpath refid="docs.classpath"/>
</taskdef>
<dvsl basedir="${docs.src}"
destdir="${docs.dir}/"
extension=".html"
style="${docs.src}/site.dvsl">
<exclude name="**/*project.xml"/>
<include name="**/*.xml"/>
</dvsl>
<!-- create printer version of documentation -->
<dvsl basedir="${docs.src}"
destdir="${docs.dir}/"
extension="-printer.html"
style="${docs.src}/site.dvsl">
<exclude name="**/*project.xml"/>
<include name="**/*.xml"/>
<tool name="toolbox.string.PrinterFriendlyVersion" value="yes" />
</dvsl>
<copy todir="${docs.dir}/images">
<fileset dir="${docs.src}/images">
<include name="*.png" />
</fileset>
</copy>
<copy todir="${docs.dir}/css">
<fileset dir="${docs.src}/css">
<include name="*.css" />
</fileset>
</copy>
</target>
<!-- Make documentation tar ball -->
<target name="tardocs" depends="javadoc,docs"
description="Combine all xdocs and docs into a tar ball.">
<!-- make sure the dist directory exists -->
<mkdir dir="${dist.dir}" />
<tar destfile="${dist.dir}/docs.tar.gz"
basedir="${basedir}"
includes="docs/**,xdocs/**"
compression="gzip" />
</target>
<!-- Build all example applications -->
<target name="examples" depends="jar.view,jar.struts,prepare.examples"
description="Compiles and jars all example applications.">
<ant antfile="${basedir}/examples.xml" target="build-examples" />
</target>
<!-- Build VelocityView - Simple application -->
<target name="simple" depends="jar.view,prepare.examples"
description="Compiles and jars the VelocityView example application.">
<property name="target" value="war"/>
<ant antfile="${basedir}/examples.xml" target="simple-example" />
</target>
<!-- Build VelocityView - Showcase application -->
<target name="showcase" depends="jar.view,prepare.examples"
description="Compiles and jars the VelocityView Showcase example application.">
<property name="target" value="war"/>
<ant antfile="${basedir}/examples.xml" target="showcase-example" />
</target>
<!-- Let the user start Jetty on his local box -->
<target name="start.showcase.webapp" description="Launches the Showcase example application using Jetty (uses http://localhost:8081 by default)">
<ant antfile="${basedir}/test.xml" target="start-showcase-webapp"/>
</target>
<!-- Let the user stop Jetty -->
<target name="stop.showcase.webapp" description="">
<ant antfile="${basedir}/test.xml" target="stop-showcase-webapp"/>
</target>
<!-- Build VelocityStruts example application -->
<target name="struts" depends="jar.struts,prepare.examples"
description="Compiles and jars the VelocityStruts example application.">
<property name="target" value="war"/>
<ant antfile="${basedir}/examples.xml" target="struts-example" />
</target>
<!-- Convenient target for rolling releases -->
<target name="release"
depends="release.source,release.binaries,env,release.howto"
description="Creates binary and source distribution files"/>
<target name="release.howto">
<echo>
***** RELEASE INSTRUCTIONS *****
* Be sure you can answer "yes" to the following:
* Was your local code up to date and free of modifications or extra files?
* Was the version number correct in both build.properties and pom.xml?
* For a final release, the distributionManagement.site.url value
in the pom.xml should be:
scpexe://people.apache.org/www/velocity.apache.org/tools/releases/velocity-tools-${project.version}
and for alpha or beta releases it should be:
scpexe://people.apache.org/www/velocity.apache.org/engine/devel/
* Do all new files have the Apache License? (use "ant rat" to double-check)
* Is ${basedir}/xdocs/changes.xml up to date?
Feel free to set an estimated release date for this version in that file;
it can be corrected later if the release is delayed.
* Is the ${basedir}/README.txt up to date for this release?
* Check that you have no uncommitted changes with 'svn status'
* Run 'ant clean compile' and 'ant clean test' with all supported JDKs
* Check that at least 'maven clean install' works.
* Check that all version numbers are in sync: build.properties, changes.xml, and pom.xml
* Check that the README.txt and other documentation are up to date.
* Write down the current svn revision so you don't have to look it up
later when you make the tag for this release (post-vote).
* Go to ${build.dir} and sign all the jar, zip, tar.gz and pom files
with your personal PGP key. If using gpg, you'll probably do this:
gpg --armor --output ${final.name}.zip.asc --detach-sig ${final.name}.zip
* Now that the distribution files have been created, you will need to sign all
of the jar, zip, pom, and tar.gz files with your private key. You can simplify
this process with a script along the lines of:
#! /bin/bash
for i in *.tar.gz *.zip *jar; do
gpg --armor --output $i.asc --detach-sig $i
done
* SSH into people.apache.org and make sure that this directory exists:
${publish.dir}
* Login to people.apache.org and create an empty folder at:
~/public_html/velocity/tools/${project.version}
* If you haven't done it before, ensure that your PGP key is appended to
/www/www.apache.org/dist/velocity/KEYS
Some instructions for that are at the top of that file.
* Use 'ant publish' to upload the distribution files to that folder.
* Review http://wiki.apache.org/velocity/ReleaseProcess for more details.
</echo>
</target>
<!-- Create source distribution files -->
<target name="release.source"
depends="clean"
description="Cleans everything and creates source distribution files">
<mkdir dir="${dist.dir}"/>
<zip zipfile="${dist.dir}/${project.id}-src.zip">
<zipfileset dir="${basedir}" prefix="${project.id}-src">
<include name="*"/>
<include name="examples/**"/>
<include name="src/**"/>
<include name="xdocs/**"/>
<include name="test/etc/**"/>
<include name="test/conf/**"/>
</zipfileset>
</zip>
<tar tarfile="${dist.dir}/${project.id}-src.tar" longfile="gnu">
<tarfileset dir="${basedir}" prefix="${project.id}-src">
<include name="*"/>
<include name="examples/**"/>
<include name="src/**"/>
<include name="xdocs/**"/>
<include name="test/etc/**"/>
<include name="test/conf/**"/>
</tarfileset>
</tar>
<gzip zipfile="${dist.dir}/${project.id}-src.tar.gz"
src="${dist.dir}/${project.id}-src.tar"/>
<!-- Create checksums for the binary distribution files -->
<checksum file="${dist.dir}/${project.id}-src.zip" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}-src.zip" algorithm="sha1" fileext=".sha1"/>
<checksum file="${dist.dir}/${project.id}-src.tar.gz" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}-src.tar.gz" algorithm="sha1" fileext=".sha1"/>
</target>
<!-- Create binary distribution files -->
<target name="release.binaries"
depends="clean,prepare,jar.struts,jar.view,jar.generic,jar.source,jar.javadoc,examples,javadoc,docs,test,showcase"
description="Builds everything and creates the binary distribution files">
<!-- Gather misc docs/files -->
<mkdir dir="${release.dir}"/>
<copy todir="${release.dir}" file="${basedir}/CONTRIBUTORS"/>
<copy todir="${release.dir}" file="${basedir}/LICENSE"/>
<copy todir="${release.dir}" file="${basedir}/NOTICE"/>
<copy todir="${release.dir}" file="${basedir}/STATUS"/>
<copy todir="${release.dir}" file="${basedir}/README.txt"/>
<copy todir="${release.dir}" file="${basedir}/WHY_THREE_JARS.txt"/>
<!-- Gather all project jars (exclude src and javadoc jars, as they're mostly for Maven) -->
<mkdir dir="${release.dir}/lib"/>
<copy todir="${release.dir}/lib">
<fileset dir="${dist.dir}">
<include name="*.jar" />
<exclude name="*-src.jar"/>
<exclude name="*-javadoc.jar"/>
</fileset>
</copy>
<!-- Gather all project dependencies -->
<copy todir="${release.dir}/lib">
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
<!-- Gather example war files -->
<mkdir dir="${release.dir}/examples"/>
<copy todir="${release.dir}/examples">
<fileset dir="${examples.home}">
<include name="*.war" />
</fileset>
</copy>
<!-- Gather all generated documentation -->
<mkdir dir="${release.dir}/docs"/>
<copy todir="${release.dir}/docs">
<fileset dir="${docs.dir}">
<include name="**" />
</fileset>
</copy>
<!-- Create binary distribution files -->
<zip zipfile="${dist.dir}/${project.id}.zip"
basedir="${dist.dir}/release"/>
<tar tarfile="${dist.dir}/${project.id}.tar" longfile="gnu"
basedir="${dist.dir}/release"/>
<gzip zipfile="${dist.dir}/${project.id}.tar.gz"
src="${dist.dir}/${project.id}.tar"/>
<!-- Create a distribution ready POM -->
<copy file="pom.xml" tofile="${dist.dir}/${project.id}.pom"/>
<!-- Create checksums for the binary distribution files -->
<checksum file="${dist.dir}/${project.id}.pom" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}.pom" algorithm="sha1" fileext=".sha1"/>
<checksum file="${dist.dir}/${project.id}.zip" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}.zip" algorithm="sha1" fileext=".sha1"/>
<checksum file="${dist.dir}/${project.id}.tar.gz" algorithm="md5" fileext=".md5"/>
<checksum file="${dist.dir}/${project.id}.tar.gz" algorithm="sha1" fileext=".sha1"/>
<!-- Delete TAR files and staging dir as they're no longer needed -->
<delete>
<fileset dir="${dist.dir}" includes="*.tar"/>
<fileset dir="${dist.dir}/release"/>
</delete>
</target>
<!-- ========== Publish Targets ======================================== -->
<target name="publish.check">
<condition property="release.signed">
<and>
<available file="${dist.dir}/${project.id}.tar.gz.asc"/>
<available file="${dist.dir}/${project.id}.zip.asc"/>
<available file="${dist.dir}/${project.id}-src.tar.gz.asc"/>
<available file="${dist.dir}/${project.id}-src.zip.asc"/>
<available file="${dist.dir}/${project.id}.jar.asc"/>
<available file="${dist.dir}/${project.id}-src.jar.asc"/>
<available file="${dist.dir}/${project.id}-javadoc.jar.asc"/>
<available file="${dist.dir}/${view.id}.jar.asc"/>
<available file="${dist.dir}/${generic.id}.jar.asc"/>
</and>
</condition>
</target>
<target name="publish.sigs" unless="release.signed"
depends="publish.check">
<echo>
You must first execute "release" target, then sign the distribution
files with your pgp key (creating the needed '.asc'signature files).
You may also need to add the Jsch jar to Ant's classpath to enable the
optional 'scp' task.
</echo>
</target>
<target name="publish.user" unless="username">
<input message="Type your username and hit enter:" addproperty="username"/>
</target>
<target name="publish.pass" unless="password">
<input message="Type your password and hit enter:" addproperty="password"/>
</target>
<target name="publish.auth"
depends="publish.user,publish.pass">
<condition property="have.auth">
<and>
<isset property="username"/>
<isset property="password"/>
</and>
</condition>
</target>
<target name="prepare.publish"
depends="publish.sigs,publish.auth">
<condition property="ready">
<and>
<isset property="release.signed"/>
<isset property="have.auth"/>
</and>
</condition>
</target>
<target name="publish.upload" depends="prepare.publish" if="ready"
description="Uploads distribution files">
<echo>
Uploading distribution files from
${dist.dir}
to
${username}:${password}@${publish.server}:${publish.dir}
</echo>
<scp todir="${username}:${password}@${publish.server}:${publish.dir}"
verbose="true" failonerror="true" trust="yes">
<fileset dir="${dist.dir}"/>
</scp>
</target>
<target name="publish.howto">
<echo>
***** RELEASE INSTRUCTIONS *****
* SSH to ${publish.server} and verify the checksums and signatures of the uploaded
files with a script like:
#!/bin/csh
foreach fn ( *.tar.gz *.zip *.jar *.pom )
echo Verifying $fn...
echo GPG signature should be "Good"
gpg --verify $fn.asc
echo MD5s should be identical
cat $fn.md5
md5 -q $fn
echo SHA1s should be identical
cat $fn.sha1
sha1 -q $fn
echo
end
* Announce the availability of the test build on the [email protected] list.
* Allow a couple days for people to test the test build.
* Call for a release vote on [email protected] and [email protected]
* Once the release vote has passed, these files should all be copied to
/www/www.apache.org/dist/velocity/tools/${project.version}
and the full jar, pom and their md5 and sha1 files should be copied into
/www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/velocity/velocity-tools/${project.version}/
* Remove older releases of the same grade as this one (alpha, beta, final) from
/www/www.apache.org/dist/velocity/tools
* Tag the release in SVN with a command such as:
svn copy -m "Release Tools ${project.version}" -r [revision #] \
https://svn.apache.org/repos/asf/velocity/tools/trunk \
https://svn.apache.org/repos/asf/velocity/tools/tags/${project.version}
* Publish the documentation for this release on the website using 'ant publish.docs'
* Update the download and news pages on the website
* Send an announcement email to all Velocity lists and [email protected]
once most of the mirrors have been updated with the distribution files.
* Review http://wiki.apache.org/velocity/ReleaseProcess for more details.
</echo>
</target>
<target name="publish" depends="publish.upload,publish.howto" if="ready"
description="Uploads distribution files to server for release"/>
<target name="publish.docs" depends="docs,publish.auth" if="have.auth"
description="Updates development documentation on the website">
<mkdir dir="${dist.dir}"/>
<zip zipfile="${dist.dir}/docs.zip"
basedir="${docs.dir}"/>
<echo>
Zips documentation files from
${docs.dir}
and uploads them to
${username}:${password}@${publish.server}:${publish.docs.dir}
</echo>
<scp todir="${username}:${password}@${publish.server}:${publish.docs.dir}"
verbose="true" failonerror="true" trust="yes">
<fileset dir="${dist.dir}">
<include name="docs.zip"/>
</fileset>
</scp>
<echo>
***** PUBLISH INSTRUCTIONS *****
* SSH into people.apache.org
* Unzip ${publish.docs.dir}docs.zip into either
${publish.docs.dir}releases/${project.version}
or
${publish.docs.dir}devel/
as appropriate.
</echo>
</target>
<target name="rat" depends="release.source,prepare"
description="Runs Apache RAT against the source code.">
<!-- TODO: download RAT and deps -->
<echo>
NOTE: At this time, you must add Apache RAT, Apache RAT AntTasks
Commons-Lang, Commons-Collections and Commons-CLI to Ant's lib directory
to use this.
</echo>
<typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks"/>
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
reportFile="${build.dir}/rat-report.txt">
<tarfileset>
<gzipresource>
<file file="${dist.dir}/${project.id}-src.tar.gz"/>
</gzipresource>
</tarfileset>
</rat:report>
<echo>Your RAT report is here: ${build.dir}/rat-report.txt</echo>
</target>
<!-- Prepare to use Maven Ant Tasks -->
<target name="maven.prepare">
<ant antfile="${basedir}/download.xml" target="build-download" />
<path id="mvnantpath" path="${lib.dir}/maven-ant-tasks-${jar.maven.ant.version}.jar"/>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpathref="mvnantpath"/>
<artifact:install-provider artifactId="wagon-ssh" version="${wagon-ssh.version}"/>
<artifact:pom file="${maven.pom}" id="maven.project"/>
</target>
<!-- Install Maven Artifacts in local repo -->
<target name="install" depends="maven.prepare,release"
description="Installs the Maven artifacts in local repository">
<artifact:install file="${dist.dir}/${project.id}.jar" >
<pom refid="maven.project"/>
<attach file="${dist.dir}/${generic.id}.jar" type="jar" classifier="generic"/>
<attach file="${dist.dir}/${view.id}.jar" type="jar" classifier="view"/>
<attach file="${dist.dir}/${project.id}-src.jar" type="jar" classifier="sources"/>
<attach file="${dist.dir}/${project.id}-javadoc.jar" type="jar" classifier="javadoc"/>
</artifact:install>
</target>
<!-- Deploy Maven artifacts to custom remote repository -->
<target name="deploy-custom" if="maven.remote.repository">
<echo>Deploying to ${maven.remote.repository}</echo>
<artifact:deploy file="${dist.dir}/${project.id}.jar" >
<remoteRepository id="velocity.custom.repository" url="${maven.remote.repository}"/>
<pom refid="maven.project"/>
<attach file="${dist.dir}/${generic.id}.jar" type="jar" classifier="generic"/>
<attach file="${dist.dir}/${view.id}.jar" type="jar" classifier="view"/>
<attach file="${dist.dir}/${project.id}-src.jar" type="jar" classifier="sources"/>
<attach file="${dist.dir}/${project.id}-javadoc.jar" type="jar" classifier="javadoc"/>
</artifact:deploy>
</target>
<!-- Deploy Maven artifacts to Apache remote repository -->
<target name="deploy-apache" unless="maven.remote.repository">
<echo>Deploying to Apache Maven repository</echo>
<artifact:deploy file="${dist.dir}/${project.id}.jar" >
<pom refid="maven.project"/>
<attach file="${dist.dir}/${generic.id}.jar" type="jar" classifier="generic"/>
<attach file="${dist.dir}/${view.id}.jar" type="jar" classifier="view"/>
<attach file="${dist.dir}/${project.id}-src.jar" type="jar" classifier="sources"/>
<attach file="${dist.dir}/${project.id}-javadoc.jar" type="jar" classifier="javadoc"/>
</artifact:deploy>
</target>
<!-- Deploy Maven artifacts to remote repository -->
<target name="deploy" depends="maven.prepare,release,deploy-custom,deploy-apache"
description="Deploys the Maven artifacts to configured repository">
</target>
<!-- ========== Test Targets ======================================== -->
<!-- Main test target -->
<target name="test" description="Test VelocityTools" depends="test.generic,test.view">
</target>
<!-- Code Analysis targets -->
<target name="findbugs" description="Run FindBugs" depends="jar">
<ant antfile="${basedir}/test.xml" target="findbugs" />
</target>
<target name="pmd" description="Run PMD" depends="compile">
<ant antfile="${basedir}/test.xml" target="pmd" />
</target>
<!-- Generic tests -->
<target name="test.generic" description="Test GenericTools" depends="jar.view">
<ant antfile="${basedir}/test.xml" target="test.generic" />
</target>
<!-- View tests -->
<target name="test.view" description="Test VelocityView" depends="jar.view">
<ant antfile="${basedir}/test.xml" target="test.view" />
</target>
<!-- View tests -->
<target name="test.stop" description="Stop VelocityView Test">
<ant antfile="${basedir}/test.xml" target="stop-showcase-webapp" />
</target>
</project>