-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·642 lines (585 loc) · 24.8 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
AntRun, a general-purpose Ant build script
Copyright (C) 2015-2023 Sylvain Hallé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<project
name="AntRun"
default="dist"
basedir="."
xmlns:jacoco="antlib:org.jacoco.ant">
<!-- The version of Ant -->
<antversion property="antversion.running" />
<!-- The build script's version number. Do not edit! -->
<property name="antrun.version" value="1.10.4"/>
<!-- Load project properties from XML file -->
<xmlproperty file="config.xml"/>
<!-- Versions of various dependencies -->
<property name="versions.jacoco" value="0.8.8"/>
<property name="versions.junit" value="1.9.2"/>
<!--
Default values. Note that Ant's properties cannot be overwritten once
set; therefore, any property with the same name defined in config.xml
will have precedence over the values below.
-->
<!-- The project's display name -->
<property name="build.name" value="AntRun"/>
<!-- The project's version number -->
<property name="build.version" value="1.0"/>
<!-- The project's package -->
<property name="build.package" value="antrun/"/>
<!-- The target JDK version for the build -->
<property name="build.targetjdk" value="11"/>
<!-- The folder where libraries (ant-contrib, etc.) will be downloaded
if necessary -->
<property name="build.libdir" value="Source/Core/lib"/>
<!-- The folder with the project's source files -->
<property name="build.srcdir" value="Source/Core/src"/>
<!-- The folder where the compiled files should go -->
<property name="build.bindir" value="Source/Core/bin"/>
<!-- The folder where the downloaded dependencies (if any) should go -->
<property name="build.depdir" value="Source/Core/dep"/>
<!-- The folder with the project's test source files -->
<property name="build.test.srcdir" value="Source/CoreTest/src"/>
<!-- The folder where the compiled test files should go -->
<property name="build.test.bindir" value="Source/CoreTest/bin"/>
<!-- The folder where the Javadoc files should go -->
<property name="build.docdir" value="doc"/>
<!-- The folder where the jUnit test reports should go -->
<property name="build.report.junitdir" value="tests/junit"/>
<!-- The folder where the coverage test reports should go -->
<property name="build.report.jacocodir" value="tests/coverage"/>
<!-- The project's main class. This is used for the generation of the
runnable JAR file in the "jar" target -->
<property name="build.mainclass" value="ca.uqac.lif.antrun.Main"/>
<!-- Debug level. If set to true, will produce more detailed reports
on test code coverage. Set to false for production. -->
<property name="build.debug" value="true"/>
<!-- Target jar file -->
<property name="build.jar.filename" value="antrun"/>
<!-- Generate a jar with the documentation -->
<property name="build.jar.withdoc" value="false"/>
<!-- Generate a jar with the sources -->
<property name="build.jar.withsrc" value="false"/>
<!-- Generate a jar with the dependencies -->
<property name="build.jar.withdeps" value="true"/>
<!-- Base name of the jar to produce (used by the "zip" target) -->
<basename property="build.jar.basename" file="${build.jar.filename}" suffix=".jar"/>
<!-- The filename pattern to recognize test source files -->
<property name="build.test.filenamepattern.src" value="**/*Test.java"/>
<!-- The filename pattern to recognize test binary files -->
<property name="build.test.filenamepattern.bin" value="**/*Test.class"/>
<!-- Target: initialization
All other targets should ultimately
depend on this one (except perhaps very simple ones such as
"clean" and "wipe".
-->
<target name="init" depends="ant-contrib,xmltask"
description="Initialize the project">
<!-- Load ant-contrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpath="${build.libdir}/ant-contrib-1.0b3.jar"/>
<!-- Load xmltask -->
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"
classpath="${build.libdir}/${xmltask.jarname}"/>
<!-- Create depdir -->
<mkdir dir="${build.depdir}"/>
<!-- Create a global classpath that other tasks will refer to -->
<path id="build.classpath">
<pathelement location="${build.bindir}"/>
<fileset dir="${build.depdir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${build.libdir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<path id="build.test.classpath">
<pathelement location="${build.bindir}"/>
<fileset dir="${build.depdir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${build.libdir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.test.bindir}"/>
<pathelement path="${java.class.path}"/>
</path>
<!-- Create empty doc folders -->
<mkdir dir="${build.docdir}"/>
<mkdir dir="${build.docdir}/doc-files"/>
</target>
<!-- Target: zip
Zips the jar
-->
<target name="zip" description="Zips the compiled jar">
<delete file="${build.jar.basename}-${build.version}.zip"/>
<zip basedir="." destfile="${build.jar.basename}-${build.version}.zip" includes="${build.jar.filename},Readme.md"/>
</target>
<!-- Target: dist
This is the default target when Ant is invoked without an argument.
-->
<target name="dist" depends="jar" description="Same as jar">
<!-- Do nothing -->
</target>
<!-- Target: compile
Compiles the main project
-->
<target name="compile" depends="init,junit,download-deps" description="Compile the sources">
<mkdir dir="${build.bindir}"/>
<javac
release="${build.targetjdk}"
srcdir="${build.srcdir}"
destdir="${build.bindir}"
debug="${build.debug}"
includeantruntime="false">
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.bindir}" includeemptydirs="false">
<fileset dir="${build.srcdir}" excludes="**/*.java,doc-files/**/*"/>
</copy>
</target>
<!-- Target: compile-tests
Compiles the unit tests
-->
<target name="compile-tests" depends="init,compile,junit" description="Compile the test sources">
<mkdir dir="${build.test.bindir}"/>
<javac
release="${build.targetjdk}"
srcdir="${build.test.srcdir}"
destdir="${build.test.bindir}"
debug="${build.debug}"
includeantruntime="false">
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.test.bindir}" includeemptydirs="false">
<fileset dir="${build.test.srcdir}" excludes="**/*.java,doc-files/**/*"/>
</copy>
</target>
<!-- Target: javadoc
Generates the javadoc associated to the project
-->
<target name="javadoc" depends="init" description="Generate the documentation">
<mkdir dir="${build.docdir}"/>
<mkdir dir="${build.docdir}/doc-files"/>
<javadoc sourcepath="${build.srcdir}"
destdir="${build.docdir}"
packagenames="*"
excludepackagenames=""
defaultexcludes="yes"
author="true"
version="true"
use="true"
Encoding="utf8"
docencoding="utf8"
charset="utf8"
windowtitle="${build.name} Documentation">
<doctitle><![CDATA[<h1>]]>${build.name}<![CDATA[ Documentation</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © ]]>${build.author}<![CDATA[. All Rights Reserved.</i>]]></bottom>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
<classpath refid="build.classpath"/>
</javadoc>
<if>
<available file="${build.srcdir}/doc-files" type="dir"/>
<then>
<copy todir="${build.docdir}/doc-files" includeemptydirs="false">
<fileset dir="${build.srcdir}/doc-files"/>
</copy>
</then>
</if>
</target>
<!-- Target: jar
Generates three JAR files with with the compiled files, source files and
Javadoc
-->
<target name="jar" depends="compile,javadoc" description="Create the runnable JAR">
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<jar destfile="${build.jar.filename}-${build.version}.jar" filesetmanifest="mergewithoutmain" duplicate="preserve" level="9">
<manifest>
<attribute name="Main-Class" value="${build.mainclass}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${TODAY}"/>
<attribute name="Implementation-Version" value="${build.version}"/>
<section name="${build.package}">
<attribute name="Main-Class" value="${build.mainclass}"/>
<attribute name="Class-Path" value="."/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${TODAY}"/>
<attribute name="Implementation-Version" value="${build.version}"/>
</section>
</manifest>
<fileset dir="${build.bindir}">
<filename name="**/*"/>
<not>
<filename name="${build.test.filenamepattern.bin}"/>
</not>
</fileset>
<zipgroupfileset dir="${build.depdir}">
<include name="**/*.jar" if="${build.jar.withdeps}"/>
</zipgroupfileset>
</jar>
<jar destfile="${build.jar.filename}-${build.version}-sources.jar" filesetmanifest="skip">
<fileset dir="${build.srcdir}">
<include name="**/*"/>
</fileset>
</jar>
<jar destfile="${build.jar.filename}-${build.version}-javadoc.jar" filesetmanifest="skip">
<fileset dir="${build.docdir}">
<include name="**/*"/>
</fileset>
</jar>
</target>
<!-- Target: test
Performs tests with jUnit
-->
<target name="test" depends="junit,jacoco,compile,compile-tests" description="Perform unit tests">
<!-- JaCoCo coverage srequires Ant 1.10.6 -->
<fail message="Ant 1.10.6+ is required. Consider using test-legacy as a workaround.">
<condition><not><antversion atleast="1.10.6"/></not></condition>
</fail>
<mkdir dir="${basedir}/${build.report.junitdir}"/>
<mkdir dir="${build.report.jacocodir}"/>
<!-- Defines junitlauncher as the task from the local JAR file. This
overcomes a bug in some Debian distributions that are missing this file
in the ant-optional package. -->
<taskdef name="junitlauncher" classname="org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask"
classpath="${build.libdir}/ant-junitlauncher-${antversion.running}.jar"/>
<!-- Load JaCoCo -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${build.libdir}/jacocoant.jar"/>
</taskdef>
<jacoco:agent property="jacocoagent" destfile="${build.report.jacocodir}/jacoco.exec" />
<junitlauncher printsummary="true" failureProperty="test.failed">
<classpath refid="build.test.classpath"/>
<testclasses outputdir="${basedir}/${build.report.junitdir}">
<fileset dir="${build.test.bindir}">
<include name="${build.test.filenamepattern.bin}"/>
</fileset>
<listener type="legacy-xml" sendSysErr="true" sendSysOut="true"/>
<fork>
<jvmarg value="${jacocoagent}"/>
</fork>
</testclasses>
</junitlauncher>
<fail if="test.failed"/>
</target>
<!-- Target: test-legacy
Performs tests with jUnit, but without using the junitlauncher task that
is supported only in Ant 1.10.6 onwards. This results in less detailed
reports. It is recommended to use only on versions of Ant prior
to 1.10.6.
-->
<target name="test-legacy" depends="junit,jacoco,compile,compile-tests" description="Perform unit tests (legacy)">
<mkdir dir="${basedir}/${build.report.junitdir}"/>
<mkdir dir="${build.report.jacocodir}"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${build.libdir}/jacocoant.jar"/>
</taskdef>
<!-- Run jUnit. Since the jacoco task does not support the nested
junitlauncher task (required by jUnit5), we run jUnit manually and
pass the JaCoCo agent as a parameter to the JVM. -->
<jacoco:agent property="agentvmparam" enabled="true" destfile="${build.report.jacocodir}/jacoco.exec" />
<java classpathref="build.test.classpath" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true">
<jvmarg value="${agentvmparam}" />
<arg line="--scan-classpath" />
<arg line="--reports-dir ${build.report.junitdir}" />
</java>
<fail if="test.failed"/>
</target>
<!-- Target: report
Generates JUnit HTML report and code coverage report with JaCoCo
-->
<target name="report" depends="junit-report,jacoco-report" description="Generate test and coverage reports">
<!-- Just call the dependencies -->
</target>
<!-- Target: junit-report
Generates JUnit HTML report and code coverage report with JaCoCo
-->
<target name="junit-report" depends="init" description="Generate unit test reports">
<!-- Don't run if no report fiels are present -->
<fail message="No test report files seem to be present. Run ant test first.">
<condition>
<resourcecount count="0">
<filelist dir="${build.report.junitdir}" files="TEST*.xml"/>
</resourcecount>
</condition>
</fail>
<junitreport todir="${basedir}/${build.report.junitdir}">
<fileset dir="${basedir}/${build.report.junitdir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${basedir}/${build.report.junitdir}"/>
</junitreport>
</target>
<!-- Target: jacoco-report
Generates JUnit code coverage report with JaCoCo
-->
<target name="jacoco-report" depends="init,jacoco" description="Generate coverage reports">
<!-- Don't run if no report fiels are present -->
<fail message="No test report files seem to be present. Run ant test first.">
<condition>
<not>
<available file="${build.report.jacocodir}/jacoco.exec" type="file"/>
</not>
</condition>
</fail>
<!-- Load JaCoCo -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${build.libdir}/jacocoant.jar"/>
</taskdef>
<jacoco:report>
<executiondata>
<file file="${build.report.jacocodir}/jacoco.exec"/>
</executiondata>
<structure name="${build.name}">
<classfiles>
<fileset dir="${build.bindir}">
<exclude name="${build.test.filenamepattern}"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${build.srcdir}"/>
</sourcefiles>
</structure>
<html destdir="${build.report.jacocodir}"/>
<xml destfile="${basedir}/${build.report.junitdir}/report.xml"/>
</jacoco:report>
</target>
<!-- Target: all
Downloads deps, compiles, runs tests, creates JAR
-->
<target name="all" depends="init,test,jar" description="Setup, compile, run tests, create JAR">
</target>
<!-- Target: wipe
Wipes any temporary files or directories
-->
<target name="wipe" depends="clean" description="Wipes the project: deletes everything but sources">
<delete>
<fileset dir="." includes="**/*~"/>
</delete>
<delete dir="${build.libdir}"/>
<delete dir="${build.docdir}"/>
<delete dir="${build.depdir}"/>
</target>
<!-- Target: clean
Deletes compiled files and test reports
-->
<target name="clean" depends="clean-reports" description="Cleans compiled files and test reports">
<delete>
<fileset dir="." includes="**/*~"/>
</delete>
<delete dir="${build.bindir}"/>
<delete dir="${build.test.bindir}"/>
</target>
<!-- Target: clean-reports
Deletes test reports
-->
<target name="clean-reports" description="Cleans compiled test reports">
<delete dir="${basedir}/${build.report.junitdir}"/>
<delete dir="${build.report.jacocodir}"/>
</target>
<!-- Target: show-properties
Prints all the properties.
-->
<target name="show-properties" depends="init" description="Print all properties">
<echoproperties/>
</target>
<!-- Target: dummy
Do nothing. This is only to test the build file
-->
<target name="dummy" description="Do nothing">
<!-- Do nothing -->
</target>
<!-- Target: run
Invokes the runnable jar generated by the "dist" target
-->
<target name="run" description="Invoke the runnable JAR">
<java jar="${build.jar.filename}" fork="true"/>
</target>
<!-- Target: antrun-version
Shows the version of AntRun
-->
<target name="antrun-version" description="Show build script version">
<echo message="This is AntRun version ${antrun.version}" level="info"/>
</target>
<!-- ==========================================
Bootstrap targets
The following targets download the necessary dependencies
the build script requires
========================================== -->
<!-- Target: ant-contrib.
Downloads ant-contrib, only if it does not exist
-->
<condition property="ant-contrib.absent" value="false" else="true">
<available file="${build.libdir}/ant-contrib-1.0b3.jar"/>
</condition>
<target name="ant-contrib" if="${ant-contrib.absent}"
description="Install ant-contrib if not present">
<echo message="ant-contrib is not installed. Downloading..." level="info"/>
<mkdir dir="${build.libdir}"/>
<get src="http://sylvainhalle.github.io/AntRun/dependencies/ant-contrib-1.0b3-bin.zip" dest="${build.libdir}/ant-contrib-1.0b3-bin.zip"/>
<unzip src="${build.libdir}/ant-contrib-1.0b3-bin.zip" dest="${build.libdir}">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<!-- Target: xmltask
Download XmlTask JAR if not present, and put it in the lib folder
-->
<property name="xmltask.jarname" value="xmltask.jar"/>
<condition property="xmltask.absent" value="false" else="true">
<available file="${build.libdir}/${xmltask.jarname}"/>
</condition>
<target name="xmltask" if="${xmltask.absent}">
<mkdir dir="${build.libdir}"/>
<get src="http://sylvainhalle.github.io/AntRun/dependencies/xmltask.jar" dest="${build.libdir}/${xmltask.jarname}"/>
</target>
<!-- Target: junit
Download jUnit JARs if not present, and puts them in the lib folder
-->
<condition property="junit.absent" value="false" else="true">
<and>
<available file="${build.libdir}/junit-platform-console-standalone-${versions.junit}.jar"/>
<available file="${build.libdir}/ant-junitlauncher-${antversion.running}.jar"/>
</and>
</condition>
<target name="junit" if="${junit.absent}" description="Install jUnit if not present">
<mkdir dir="${build.libdir}"/>
<get src="https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/${versions.junit}/junit-platform-console-standalone-${versions.junit}.jar" dest="${build.libdir}/junit-platform-console-standalone-${versions.junit}.jar"/>
<get src="https://repo1.maven.org/maven2/org/apache/ant/ant-junitlauncher/${antversion.running}/ant-junitlauncher-${antversion.running}.jar" dest="${build.libdir}/ant-junitlauncher-${antversion.running}.jar"/>
</target>
<!-- Target: jacoco
Download JaCoCo if not present, and put it in the lib folder
-->
<property name="jacoco.jarname" value="jacocoant.jar"/>
<condition property="jacoco.absent" value="false" else="true">
<available file="${build.libdir}/${jacoco.jarname}"/>
</condition>
<target name="jacoco" if="${jacoco.absent}" description="Install JaCoCo if not present">
<mkdir dir="${build.libdir}"/>
<get src="https://github.com/jacoco/jacoco/releases/download/v${versions.jacoco}/jacoco-${versions.jacoco}.zip" dest="${build.libdir}/jacoco.zip"/>
<unzip src="${build.libdir}/jacoco.zip" dest="${build.libdir}">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<!-- Task: check-deps
Loops through all dependencies specified in config.xml; checks if
the target class name exists in the classpath and prints a status
message for each.
-->
<target name="check-deps" depends="init" description="Check dependency status">
<sequential>
<mkdir dir="${build.depdir}"/>
<xmltask source="config.xml">
<call path="/build/dependencies/dependency">
<param name="depname" path="name/text()"/>
<param name="classname" path="classname/text()"/>
<actions>
<if>
<available classname="@{classname}" classpathref="build.classpath"/>
<then>
<echo message="@{depname} is installed" level="info"/>
</then>
<else>
<echo message="@{depname} is missing from the classpath" level="info"/>
</else>
</if>
</actions>
</call>
</xmltask>
</sequential>
</target>
<!-- Task: download-deps
Loops through all dependencies specified in config.xml; checks if
the target class name exists in the classpath; if not, downloads the
files specified in the <files> section to ${build.depdir}. In the case of
a zip, unzips all jar files found in the archive and copies them to
${build.depdir}.
-->
<target name="download-deps" depends="init" description="Download unsatisfied JAR dependencies">
<sequential>
<mkdir dir="${build.depdir}"/>
<xmltask source="config.xml">
<call path="/build/dependencies/dependency">
<param name="bundle" path="bundle/text()"/>
<param name="depname" path="name/text()"/>
<param name="classname" path="classname/text()"/>
<actions>
<var name="depdest" value="${build.depdir}"/>
<if>
<equals arg1="false" arg2="@{bundle}" casesensitive="true" trim="true"/>
<then>
<var name="depdest" value="${build.libdir}"/>
</then>
</if>
<echo message="Checking if @{depname} is installed" level="info"/>
<if>
<available classname="@{classname}" classpathref="build.classpath"/>
<then>
<!-- It's there, do nothing -->
</then>
<else>
<echo message="@{depname} not present in classpath. Downloading and copying into ${depdest}..." level="info"/>
<xmltask source="config.xml">
<call path="/build/dependencies/dependency[name='@{depname}']/files/jar">
<param name="url" path="text()"/>
<actions>
<get src="@{url}" dest="${depdest}"/>
</actions>
</call>
<call path="/build/dependencies/dependency[name='@{depname}']/files/zip">
<param name="url" path="text()"/>
<actions>
<get src="@{url}" dest="${depdest}"/>
<var name="basename" unset="true"/>
<basename property="basename" file="@{url}"/>
<unzip src="${depdest}/${basename}" dest="${depdest}">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</actions>
</call>
<call path="/build/dependencies/dependency[name='@{depname}']/files/tgz">
<param name="url" path="text()"/>
<actions>
<get src="@{url}" dest="${depdest}"/>
<var name="basename" unset="true"/>
<basename property="basename" file="@{url}"/>
<untar src="${depdest}/${basename}" dest="${depdest}" compression="gzip">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</untar>
</actions>
</call>
</xmltask>
</else>
</if>
</actions>
</call>
</xmltask>
</sequential>
</target>
</project>
<!-- :tabWidth=2:mode=ant: -->