-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
807 lines (678 loc) · 35.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
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
<?xml version="1.0" encoding="utf-8"?>
<project name="Wetator Ant Task" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- make environment variables of operation system available -->
<property environment="env" />
<!-- path to ant-dir -->
<property name="ant" value="ant" />
<condition property="is-ci">
<equals arg1="${stage}" arg2="CI" />
</condition>
<!-- application specific properties -->
<xmlproperty file="./build-properties.xml" keepRoot="false" semanticAttributes="true" />
<import file="./build-patternset.xml" />
<!--
publish-sonatype-releases: info -> resolve-dependencies -> compile -> compile-tests -> run-tests -> gather-metrics -> package-bundles -> publish-local -> publish-sonatype-releases
publish-sonatype-snapshots: info -> resolve-dependencies -> compile -> compile-tests -> run-tests -> gather-metrics -> package-bundles -> publish-local -> publish-sonatype-snapshots
publish-local: info -> resolve-dependencies -> compile -> compile-tests -> run-tests -> gather-metrics -> package-bundles -> publish-local
package: info -> resolve-dependencies -> compile -> compile-tests -> run-tests -> gather-metrics -> package-bundles
package-no-tests: info -> resolve-dependencies -> compile -> package-bundles
package-only: info -> compile -> package-bundles
metrics: info -> resolve-dependencies -> compile -> compile-tests -> run-tests -> gather-metrics
metrics-only: info -> compile -> gather-metrics
tests: info -> resolve-dependencies -> compile -> compile-tests -> run-tests
tests-only: info -> compile -> compile-tests -> run-tests
-->
<!-- *******************************************
target publish-sonatype-releasess
executes the complete build cycle until
publishing to the Sonatype release
repository:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
-> gather-metrics -> package-bundles
-> publish-local
-> publish-sonatype-releases
******************************************* -->
<target name="publish-sonatype-releases" description="executes the complete build cycle until publishing to the Sonatype snapshot repository"
depends="info, resolve-dependencies, -run-tests, -gather-metrics, -check-tests, -package-bundles, -publish-local, -publish-sonatype-releases">
</target>
<!-- *******************************************
target publish-sonatype-snapshots
executes the complete build cycle until
publishing to the Sonatype snapshot
repository:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
-> gather-metrics -> package-bundles
-> publish-local
-> publish-sonatype-snapshots
******************************************* -->
<target name="publish-sonatype-snapshots" description="executes the complete build cycle until publishing to the Sonatype snapshot repository"
depends="info, resolve-dependencies, -run-tests, -gather-metrics, -check-tests, -package-bundles, -publish-local, -publish-sonatype-snapshots">
</target>
<!-- *******************************************
target publish-local
executes the complete build cycle until
publishing to the local repository:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
-> gather-metrics -> package-bundles
-> publish-local
******************************************* -->
<target name="publish-local" description="executes the complete build cycle until publishing to the local repository"
depends="info, resolve-dependencies, -run-tests, -gather-metrics, -check-tests, -package-bundles, -publish-local">
</target>
<!-- *******************************************
target package
executes the complete build cycle until
packaging the bundles:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
-> gather-metrics -> package-bundles
******************************************* -->
<target name="package" description="executes the complete build cycle until packaging the bundles"
depends="info, resolve-dependencies, -run-tests, -gather-metrics, -check-tests, -package-bundles">
</target>
<!-- *******************************************
target package-no-tests
executes the build cycle until packaging
the bundles without the tests:
info -> resolve-dependencies -> compile
-> package-bundles
******************************************* -->
<target name="package-no-tests" description="executes the build cycle until packaging the bundles without the tests"
depends="/notests, /nometrics, package">
</target>
<!-- *******************************************
target package-only
only packages the bundles
******************************************* -->
<target name="package-only" description="only packages the bundles"
depends="/noresolve, /notests, /nometrics, package">
</target>
<!-- *******************************************
target metrics
executes the complete build cycle until
gathering the metrics:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
-> gather-metrics
******************************************* -->
<target name="metrics" description="executes the complete build cycle until gathering the metrics"
depends="info, resolve-dependencies, -run-tests, -gather-metrics, -check-tests">
</target>
<!-- *******************************************
target metrics-only
only gathers the metrics:
info -> compile -> gather-metrics
******************************************* -->
<target name="metrics-only" description="only gathers the metrics"
depends="/noresolve, /notests, metrics">
</target>
<!-- *******************************************
target tests
executes the complete build cycle until
running the tests:
info -> resolve-dependencies -> compile
-> compile-tests -> run-tests
******************************************* -->
<target name="tests" description="executes the complete build cycle until running the tests"
depends="info, resolve-dependencies, -run-tests, -check-tests">
</target>
<!-- *******************************************
target tests-only
runs the tests only:
info -> compile
-> compile-tests -> run-tests
******************************************* -->
<target name="tests-only" description="runs the tests only"
depends="/noresolve, tests">
</target>
<!-- *******************************************
target /noresolve
use to skip resolving dependencies
******************************************* -->
<target name="/noresolve" description="use to skip resolving dependencies">
<property name="skip.resolve" value="true" />
</target>
<!-- *******************************************
target /notests
use to skip running tests
******************************************* -->
<target name="/notests" description="use to skip running tests">
<property name="skip.tests" value="true" />
</target>
<!-- *******************************************
target /nometrics
use to skip gathering metrics
******************************************* -->
<target name="/nometrics" description="use to skip gathering metrics">
<property name="skip.metrics" value="true" />
</target>
<!-- *******************************************
target info
displays some info about the build
******************************************* -->
<target name="info" description="displays some info about the build">
<echo level="info"></echo>
<echo level="info">Project: ${ant.project.name}</echo>
<echo level="info"> ${ant.version}</echo>
<echo level="info"> Java version ${ant.java.version}</echo>
<echo level="info"></echo>
</target>
<!-- ===========================================
private target clean-lib
cleans the project libraries directory
(dependencies)
=========================================== -->
<target name="-clean-lib" unless="skip.resolve">
<mkdir dir="${dir.lib}"/>
<mkdir dir="${dir.lib-src}"/>
<delete includeemptydirs="true">
<fileset dir="${dir.lib}" includes="**/*"/>
<fileset dir="${dir.lib-src}" includes="**/*"/>
</delete>
</target>
<!-- ===========================================
private target load-ivy
=========================================== -->
<target name="-load-ivy">
<!-- try to load ivy here from home ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as ivy home lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the ivy home lib dir. -->
<path id="ivy.lib.path">
<fileset dir="./ant_lib" includes="ivy*.jar"/>
<fileset dir="./ant_lib" includes="bcp*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<ivy:configure override="true" />
</target>
<!-- *******************************************
target resolve-dependencies
resolves and retrieves dependencies
with ivy
******************************************* -->
<target name="resolve-dependencies" description="resolves and retrieves dependencies with ivy"
depends="info, -clean-lib, -load-ivy" unless="skip.resolve">
<echo level="info">Resolving dependencies</echo>
<!-- first resolve the sources to have the jars resolved afterwards still in memory for further use -->
<ivy:resolve conf="sources" />
<ivy:retrieve pattern="${dir.lib-src}${ivy.retrieve.pattern}" sync="true" type="source" />
<ivy:resolve conf="default, master, compile, provided, runtime, test, optional" />
<ivy:retrieve pattern="${dir.lib}${ivy.retrieve.pattern}" sync="true" type="jar,bundle,orbit" />
<!-- a bit strage but delete fails if the dir is not there at all and git ignores empty dirs -->
<mkdir dir="${dir.xsl}" />
<delete includeemptydirs="true">
<fileset dir="${dir.xsl}" includes="**/*"/>
</delete>
<unzip dest=".">
<fileset dir="${dir.lib-src}">
<include name="wetator-*-sources.jar" />
</fileset>
<patternset>
<include name="${dir.xsl}/**" />
</patternset>
</unzip>
</target>
<!-- ===========================================
private target clean-build
cleans the built project files
=========================================== -->
<target name="-clean-build">
<delete includeemptydirs="true" dir="${dir.build}"/>
</target>
<!-- ===========================================
private target compile
compiles the sources (not test sources)
=========================================== -->
<target name="-compile" depends="-clean-build">
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.build}/classes"/>
<!-- compile classes -->
<echo level="info">Compiling sources with Java target ${javac.target}</echo>
<javac srcdir="${dir.src}" encoding="utf-8" debug="on" debuglevel="lines,vars,source"
source="${javac.source}" target="${javac.target}"
destdir="${dir.build}/classes" includeantruntime="false">
<classpath>
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
</classpath>
<compilerarg value="-Xlint:deprecation"/>
</javac>
<!-- copy resources -->
<copy todir="${dir.build}/classes" preservelastmodified="yes">
<fileset dir="${dir.src}">
<patternset refid="resourcePattern" />
</fileset>
</copy>
</target>
<!-- ===========================================
private target compile-tests
compiles the test sources
=========================================== -->
<target name="-compile-tests" depends="-clean-build" unless="skip.tests">
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.build}/test-classes"/>
<!-- compile classes -->
<echo level="info">Compiling test sources with Java target ${javac.target}</echo>
<javac srcdir="${dir.test-src}" encoding="utf-8" debug="on" debuglevel="lines,vars,source"
source="${javac.source}" target="${javac.target}"
destdir="${dir.build}/test-classes" includeantruntime="false">
<classpath>
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
<path path="${dir.build}/classes" />
</classpath>
</javac>
<!-- copy resources -->
<copy todir="${dir.build}/test-classes" preservelastmodified="yes">
<fileset dir="${dir.test-src}">
<patternset refid="resourcePattern" />
</fileset>
</copy>
</target>
<!-- ===========================================
private target run-tests
runs all tests
=========================================== -->
<target name="-run-tests" description="runs all tests"
depends="-compile, -compile-tests" unless="skip.tests">
<delete dir="${dir.deploy}/junit" includeEmptyDirs="true"/>
<mkdir dir="${dir.deploy}/junit"/>
<echo level="info">Running tests (output: ${dir.deploy}/junit)</echo>
<path id="classpath-junit">
<pathelement location="${dir.build}/classes" />
<pathelement location="${dir.build}/test-classes" />
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
</path>
<!-- run tests to create xml report -->
<junit printsummary="withOutAndErr"
haltonfailure="no" failureproperty="unittestsfailed"
fork="yes" forkmode="once" dir="${basedir}">
<classpath refid="classpath-junit" />
<jvmarg value="-Duser.language=en" />
<batchtest todir="${dir.deploy}/junit">
<formatter type="xml" />
<fileset dir="${dir.build}/test-classes">
<patternset refid="junitPattern" />
</fileset>
</batchtest>
</junit>
</target>
<!-- ===========================================
private target load-checkstyle
=========================================== -->
<target name="-load-checkstyle" depends="-load-ivy" unless="skip.metrics">
<ivy:cachepath organisation="com.puppycrawl.tools" module="checkstyle" revision="8.42" type="jar,bundle"
pathid="taskdef-classpath-checkstyle" inline="true" transitive="true" log="download-only" />
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpathref="taskdef-classpath-checkstyle" />
</target>
<!-- ===========================================
private target load-spotbugs
=========================================== -->
<target name="-load-spotbugs" depends="-load-ivy" unless="skip.metrics">
<ivy:cachepath organisation="com.github.spotbugs" module="spotbugs-ant" revision="4.2.3" type="jar,bundle"
pathid="taskdef-classpath-spotbugs" inline="true" transitive="true" log="download-only" />
<taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpathref="taskdef-classpath-spotbugs" />
</target>
<!-- ===========================================
private target load-pmd
=========================================== -->
<target name="-load-pmd" depends="-load-ivy" unless="skip.metrics">
<ivy:cachepath organisation="net.sourceforge.pmd" module="pmd-java" revision="6.35.0" type="jar,bundle"
pathid="taskdef-classpath-pmd" inline="true" transitive="true" log="download-only" />
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="taskdef-classpath-pmd" />
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="taskdef-classpath-pmd" />
</target>
<!-- ===========================================
private target load-forbiddenapis
=========================================== -->
<target name="-load-forbiddenapis" depends="-load-ivy" unless="skip.metrics">
<ivy:cachepath organisation="de.thetaphi" module="forbiddenapis" revision="3.1" type="maven-plugin"
pathid="taskdef-classpath-forbiddenapis" inline="true" transitive="true" log="download-only" />
<taskdef name="forbiddenapis" classname="de.thetaphi.forbiddenapis.ant.AntTask" classpathref="taskdef-classpath-forbiddenapis" />
</target>
<!-- ===========================================
private target gather-metrics
gathers all metrics
=========================================== -->
<target name="-gather-metrics" description="gathers all metrics"
depends="-compile, -load-checkstyle, -load-spotbugs, -load-pmd, -load-forbiddenapis" unless="skip.metrics">
<!-- run checkstyle -->
<echo level="info">Running Checkstyle (output: ${dir.deploy}/checkstyle)</echo>
<delete dir="${dir.deploy}/checkstyle" includeemptydirs="true" />
<mkdir dir="${dir.deploy}/checkstyle" />
<checkstyle config="${dir.test}/checkstyle/checkstyle.xml" failOnViolation="false">
<formatter type="xml" tofile="${dir.deploy}/checkstyle/checkstyle-report.xml"/>
<fileset dir="${dir.src}">
<patternset refid="checkstylePattern" />
</fileset>
<classpath>
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
<path path="${dir.build}/classes" />
</classpath>
</checkstyle>
<!-- run spotbugs -->
<echo level="info">Running SpotBugs (output: ${dir.deploy}/spotbugs)</echo>
<path id="spotbugs-aux-classpath">
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
</path>
<delete dir="${dir.deploy}/spotbugs" includeemptydirs="true" />
<mkdir dir="${dir.deploy}/spotbugs" />
<spotbugs jvmargs="-Xmx512m" output="xml:withMessages"
outputFile="${dir.deploy}/spotbugs/spotbugs-report.xml" timeout="1800000"
excludeFilter="${dir.test}/spotbugs/exclude-filter.xml">
<classpath refid="taskdef-classpath-spotbugs" />
<auxclasspath refid="spotbugs-aux-classpath" />
<sourcePath path="${dir.src}" />
<class location="${dir.build}/classes" />
</spotbugs>
<!-- run pmd -->
<echo level="info">Running PMD (output: ${dir.deploy}/pmd)</echo>
<mkdir dir="${dir.deploy}/pmd" />
<pmd shortFilenames="true" encoding="UTF-8" cacheLocation="${dir.build}/pmd">
<sourceLanguage name="java" version="${javac.target}"/>
<ruleset>${dir.test}/pmd/wet-bestpractices.xml,${dir.test}/pmd/wet-codestyle.xml,${dir.test}/pmd/wet-design.xml,${dir.test}/pmd/wet-errorprone.xml,${dir.test}/pmd/wet-multithreading.xml,${dir.test}/pmd/wet-performance.xml</ruleset>
<formatter type="xml" toFile="${dir.deploy}/pmd/pmd-report.xml">
<param name="encoding" value="UTF-8" />
</formatter>
<fileset dir="${dir.src}">
<patternset refid="pmdPattern" />
</fileset>
</pmd>
<cpd minimumTokenCount="100" outputFile="${dir.deploy}/pmd/cpd-report.xml" format="xml" encoding="UTF-8">
<fileset dir="${dir.src}">
<patternset refid="pmdPattern" />
</fileset>
</cpd>
<!-- run forbiddenapis -->
<forbiddenapis dir="${dir.build}/classes" targetVersion="${javac.target}">
<classpath>
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
</classpath>
<bundledsignatures name="jdk-unsafe"/>
<bundledsignatures name="jdk-deprecated"/>
<bundledsignatures name="jdk-non-portable"/>
<bundledsignatures name="commons-io-unsafe-2.5"/>
<!--signaturesFileset file="path/to/signatures.txt"/-->
</forbiddenapis>
</target>
<!-- ===========================================
private target check-tests
=========================================== -->
<target name="-check-tests" if="unittestsfailed">
<fail message="Unit tests failing; build failed." />
</target>
<!-- ===========================================
private target get-buildnumber-local
=========================================== -->
<target name="-get-buildnumber-local" unless="is-ci">
<propertyfile file="build.properties">
<entry key="application.buildnumber" type="int" default="42" operation="+"/>
</propertyfile>
<property file="build.properties"/>
</target>
<!-- ===========================================
private target get-buildnumber-ci
=========================================== -->
<target name="-get-buildnumber-ci" if="is-ci">
<property name="application.buildnumber" value="jenkins-${env.BUILD_NUMBER}"></property>
</target>
<!-- ===========================================
private target get-buildnumber
=========================================== -->
<target name="-get-buildnumber" depends="-get-buildnumber-local, -get-buildnumber-ci">
</target>
<!-- ===========================================
private target package-bundles
builds all release artifacts
=========================================== -->
<target name="-package-bundles" description="builds all release artifacts"
depends="-compile, -get-buildnumber, -load-ivy">
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd HH-mm-ss z" timezone="Europe/Berlin" locale="en"/>
</tstamp>
<echo level="info">Packaging bundles (output: ${dir.deploy})</echo>
<echo level="info"> Version: ${application.version}</echo>
<echo level="info"> Build: ${application.buildnumber}</echo>
<mkdir dir="${dir.deploy}"/>
<!-- generate jar -->
<delete file="${dir.build}/${application.jar-basename}.jar"/>
<jar destfile="${dir.build}/${application.jar-basename}.jar">
<fileset dir="${dir.build}/classes">
<include name="**/*.*"/>
</fileset>
<manifest>
<section name="Application">
<attribute name="Application-Name" value="${application.name}"/>
<attribute name="Vendor" value="${application.vendor}"/>
<attribute name="Version" value="${application.version}"/>
<attribute name="Build" value="${application.buildnumber}"/>
<attribute name="Date" value="${timestamp}"/>
</section>
<section name="Build">
<attribute name="Java-Runtime" value="${java.runtime.name}" />
<attribute name="Java-Version" value="${java.runtime.version}" />
<attribute name="Java-Target" value="${javac.target}" />
<attribute name="OS-Name" value="${os.name}"/>
<attribute name="OS-Version" value="${os.version}"/>
</section>
</manifest>
</jar>
<copy file="${dir.build}/${application.jar-basename}.jar" tofile="${dir.deploy}/${application.jar-basename}-${application.version}.jar"/>
<!-- generate javadoc -->
<delete file="${dir.build}/${application.jar-basename}-javadoc.jar"/>
<javadoc destdir="${dir.build}/jdoc">
<fileset dir="${dir.src}" >
</fileset>
<classpath>
<fileset dir="${dir.lib}">
<patternset refid="libPattern" />
</fileset>
</classpath>
</javadoc>
<zip destfile="${dir.build}/${application.jar-basename}-javadoc.jar">
<fileset dir="${dir.build}/jdoc" >
</fileset>
</zip>
<copy file="${dir.build}/${application.jar-basename}-javadoc.jar" tofile="${dir.deploy}/${application.jar-basename}-${application.version}-javadoc.jar"/>
<!-- generate sources jar -->
<zip destfile="${dir.build}/${application.jar-basename}-sources.jar">
<fileset dir="." >
<include name=".checkstyle" />
<include name=".classpath" />
<include name=".project" />
<include name="build.xml" />
<include name="build-properties.xml" />
<include name="build-patternset.xml" />
<include name="build.properties" />
<include name="ivy.xml" />
<include name="ivysettings.xml" />
<include name="LICENSE.txt" />
<include name="pom.template.xml" />
<include name="readme.txt" />
</fileset>
<zipfileset dir="${dir.ant-lib}" prefix="${dir.ant-lib}">
</zipfileset>
<zipfileset dir="${dir.lib}" prefix="${dir.lib}">
<exclude name="**/**" />
</zipfileset>
<zipfileset dir="${dir.samples}" prefix="${dir.samples}">
<exclude name="**/**" />
</zipfileset>
<zipfileset dir="${dir.src}" prefix="${dir.src}">
<exclude name="**/jdoc/**" />
<exclude name="**/*.jpage*" />
</zipfileset>
<zipfileset dir="${dir.test}" prefix="${dir.test}">
<exclude name="**/jdoc/**" />
<exclude name="**/*.jpage*" />
</zipfileset>
<zipfileset dir="${dir.xsl}" prefix="${dir.xsl}">
<include name="**/**.js" />
<include name="**/**.png" />
<include name="**/**.xsl" />
</zipfileset>
</zip>
<copy file="${dir.build}/${application.jar-basename}-sources.jar" tofile="${dir.deploy}/${application.jar-basename}-${application.version}-sources.jar"/>
<!-- generate pom -->
<ivy:makepom ivyfile="ivy.xml" pomfile="${dir.build}/${application.jar-basename}.pom" templatefile="pom.template.xml"
artifactpackaging="jar">
<mapping conf="default" scope="compile" />
<mapping conf="compile" scope="compile" />
<mapping conf="provided" scope="provided" />
<mapping conf="runtime" scope="runtime" />
<mapping conf="test" scope="test" />
</ivy:makepom>
<!-- generate ant distribution zip -->
<zip destfile="${dir.deploy}/${application.jar-basename}-${application.version}.zip">
<zipfileset dir="${dir.build}" prefix="lib" >
<include name="${application.jar-basename}.jar" />
</zipfileset>
<zipfileset dir="${dir.lib}" prefix="lib">
<patternset refid="runtime-libs" />
</zipfileset>
<zipfileset dir="${dir.samples}/ant" prefix="templates">
<include name="build.xml" />
</zipfileset>
<zipfileset dir="${dir.samples}" prefix="samples">
<include name="google_search/**" />
<exclude name="google_search/logs/**" />
</zipfileset>
<zipfileset dir="${dir.xsl}" prefix="xsl">
</zipfileset>
<zipfileset dir="${dir.samples}" prefix="templates">
<include name="wetator.config" />
<include name="js_filter.cfg" />
</zipfileset>
</zip>
</target>
<!-- ===========================================
private target publish-local
publishes the release artifacts to the
local Maven repository
=========================================== -->
<target name="-publish-local" depends="-package-bundles, -load-ivy" description="publishes the Wetator release artifacts to the local Maven repository">
<ivy:publish resolver="local-m2-publish" forcedeliver="true" overwrite="true" publishivy="false"
pubrevision="${application.pubversion}">
<artifacts pattern="${dir.build}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
<!-- ===========================================
private target publish-sonatype-releases
publishes the release artifacts to the
Sonatype release repository
=========================================== -->
<target name="-publish-sonatype-releases" depends="-package-bundles, -load-ivy" description="publishes the Wetator release artifacts to the Sonatype release repository">
<ivy:publish resolver="SonatypeReleases-publish" forcedeliver="true" overwrite="true" publishivy="false"
pubrevision="${application.pubversion}">
<artifacts pattern="${dir.build}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
<!-- ===========================================
private target publish-sonatype-snapshots
publishes the release artifacts to the
Sonatype snapshots repository
=========================================== -->
<target name="-publish-sonatype-snapshots" depends="-package-bundles, -load-ivy" description="publishes the Wetator release artifacts to the Sonatype snapshots repository">
<ivy:publish resolver="SonatypeSnapshots-publish" forcedeliver="true" overwrite="true" publishivy="false"
pubrevision="${application.pubversion}">
<artifacts pattern="${dir.build}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
<!-- *******************************************
target test-release
tests the release artifacts
******************************************* -->
<target name="test-release" description="test the wetator release artefacts" >
<echo level="info">Testing version: ${application.version}</echo>
<echo></echo>
<!-- new dir for the tests -->
<delete dir="${dir.build}/test-release" />
<mkdir dir="${dir.build}/test-release" />
<!-- test the ant task -->
<unzip src="${dir.deploy}/${application.jar-basename}-${application.version}.zip" dest="${dir.build}/test-release/ant" />
<copy
file="${basedir}/${dir.build}/test-release/ant/samples/google_search/wetator.config"
todir="${basedir}/${dir.build}/test-release/ant"
/>
<copy
file="${basedir}/${dir.build}/test-release/ant/samples/google_search/google.xls"
todir="${basedir}/${dir.build}/test-release/ant"
/>
<echo file="${dir.build}/test-release/ant/build.xml"><![CDATA[<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Wetator Ant Test" basedir="${basedir}/${dir.build}/test-release/ant" default="run_wetator">
<path id="wetator-classpath">
<path path="../../bin"/>
<fileset dir="./lib" includes="**/**.jar"/>
</path>
<taskdef name="wetator" classname="org.wetator.ant.Wetator" classpathref="wetator-classpath">
<classpath>
<path path="../../bin"/>
</classpath>
</taskdef>
<target name="run_wetator">
<wetator config="wetator.config">
<classpath refid="wetator-classpath" />
<fileset dir="." >
<include name="*.xls"/>
</fileset>
</wetator>
</target>
</project>
]]>
</echo>
<fail unless="env.ANT_HOME" message="ANT_HOME not set. Please install ant and set ANT_HOME."/>
<exec executable="cmd">
<arg value="/c" />
<arg value="${env.ANT_HOME}\bin\ant.bat" />
<arg value="-buildfile" />
<arg value="${dir.build}/test-release/ant/build.xml" />
</exec>
</target>
<!-- *******************************************
target report-dependencies
generates a report of the dependencies
******************************************* -->
<target name="report-dependencies" description="generates a report of the dependencies"
depends="info, resolve-dependencies, -load-ivy" unless="skip.resolve">
<echo level="info">Creating dependency report (output: ${dir.deploy}/ivy-report)</echo>
<delete dir="${dir.deploy}/ivy-report" />
<mkdir dir="${dir.deploy}/ivy-report" />
<ivy:report todir="${dir.deploy}/ivy-report" />
</target>
<!-- *******************************************
target zip-curret-libs
bundles the current libs as zip
******************************************* -->
<target name="zip-current-libs" description="bundles the current libs as zip"
depends="info">
<zip destfile="${dir.deploy}/current-libs.zip">
<zipfileset dir="${dir.lib}" prefix="lib" />
<zipfileset dir="${dir.lib-src}" prefix="lib_src" />
</zip>
</target>
<!-- *******************************************
target clean
cleans the project
******************************************* -->
<target name="clean" depends="info, -clean-build, -clean-lib" description="cleans the project" />
<!-- *******************************************
target clean-cache
cleans the ivy cache
******************************************* -->
<target name="clean-cache" depends="-load-ivy" description="cleans the ivy cache">
<ivy:cleancache />
</target>
</project>