Codebase list ivy / lintian-fixes/main build.xml
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

build.xml @lintian-fixes/mainraw · history · blame

  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
<!--
   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

     https://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="ivy" default="test-report" xmlns:ivy="antlib:org.apache.ivy.ant">

    <property environment="env"/>
    <property file="version.properties"/>
    <property file="build.properties"/>

    <property name="final.name" value="ivy.jar"/>

    <target name="init-ivy-user-home" unless="ivy.use.local.home">
        <condition property="ivy.home" value="${env.IVY_HOME}">
            <isset property="env.IVY_HOME"/>
        </condition>
        <property name="ivy.home" value="${user.home}/.ivy2"/>
    </target>

    <target name="init-ivy-local-home" if="ivy.use.local.home">
        <property name="ivy.home" value="${basedir}/.ivy2"/>
    </target>

    <target name="init-ivy-home" depends="init-ivy-user-home,init-ivy-local-home"/>

    <target name="init-ivy" depends="compile-bootstrap,init-ivy-home">
        <taskdef resource="org/apache/ivy/ant/antlib.xml"
                 uri="antlib:org.apache.ivy.ant">
            <classpath>
                <pathelement location="${core.classes.build.dir}"/>
                <pathelement location="${bootstrap.classes.build.dir}"/>
            </classpath>
        </taskdef>

        <ivy:configure override="true"/>
    </target>

    <target name="install" depends="jar"
            description="build Ivy and install it in Ivy user home for builds using Ivy user home to load Ivy jar">
        <property name="ivy.jar.file" value="${ivy.home}/jars/ivy.jar"/>
        <copy file="${artifacts.build.dir}/jars/${final.name}" tofile="${ivy.jar.file}"/>
    </target>

    <target name="install-ant" depends="jar"
        description="build Ivy and install it in Ant home lib">
        <condition property="ant.home" value="${env.ANT_HOME}">
            <isset property="env.ANT_HOME"/>
        </condition>
        <fail unless="ant.home" message="ANT_HOME environment variable or ant.home property required"/>
        <copy file="${artifacts.build.dir}/jars/${final.name}" tofile="${ant.home}/lib/ivy.jar"/>
    </target>

    <!-- =================================================================
         PREPARATION, CLEANING AND FLAGS TASKS
         ================================================================= -->
    <target name="init">
        <path id="lib.classpath">
            <fileset dir="${lib.dir}">
                <include name="*.jar"/>
            </fileset>
        </path>
        <path id="build.bootstrap.classpath">
            <pathelement location="${core.classes.build.dir}"/>
        </path>
        <path id="build.ant.classpath">
            <pathelement location="${core.classes.build.dir}"/>
            <path refid="lib.classpath"/>
        </path>
        <path id="build.optional.classpath">
            <path refid="build.ant.classpath"/>
        </path>
        <path id="run.classpath">
            <pathelement location="${core.classes.build.dir}"/>
            <pathelement location="${ant.classes.build.dir}"/>
            <pathelement location="${optional.classes.build.dir}"/>
            <path refid="lib.classpath"/>
        </path>
        <path id="test.classpath">
            <fileset dir="${lib.dir}" />
            <pathelement location="${core.classes.build.dir}"/>
            <pathelement location="${ant.classes.build.dir}"/>
            <pathelement location="${optional.classes.build.dir}"/>
            <pathelement path="${test.build.dir}"/>
        </path>
        <path id="javadoc.test.classpath">
            <path refid="run.classpath"/>
            <pathelement path="${test.build.dir}"/>
        </path>
    </target>

    <target name="prepare" depends="init">
        <mkdir dir="${classes.build.dir}"/>
        <mkdir dir="${core.classes.build.dir}"/>
        <mkdir dir="${bootstrap.classes.build.dir}"/>
        <mkdir dir="${ant.classes.build.dir}"/>
        <mkdir dir="${optional.classes.build.dir}"/>
        <mkdir dir="${all.classes.build.dir}"/>
        <mkdir dir="${test.build.dir}"/>
        <mkdir dir="${artifacts.build.dir}"/>
        <mkdir dir="${test.report.dir}"/>
    </target>

    <target name="clean" description="delete all generated files keeping sources only">
        <delete dir="${classes.build.dir}"/>
        <delete dir="${test.build.dir}"/>
        <delete dir="${artifacts.build.dir}"/>
        <delete dir="${ivy.report.dir}"/>
        <delete dir="${test.report.dir}"/>
        <delete dir="${javadoc.build.dir}"/>
        <delete dir="${doc.build.dir}"/>
        <delete dir="${build.dir}"/>
    </target>

    <target name="clean-lib">
        <delete dir="${lib.dir}"/>
    </target>

    <target name="clean-ivy-cache" depends="init-ivy-home">
        <delete dir="${ivy.home}/cache"/>
    </target>

    <target name="clean-ivy-home" depends="init-ivy-home">
        <delete dir="${ivy.home}"/>
    </target>

    <target name="clean-examples" description="clean all examples">
        <subant target="clean" failonerror="false">
            <fileset dir="${example.dir}" includes="**/build.xml"/>
        </subant>
    </target>

    <target name="clean-all" depends="clean-examples,clean,clean-lib"/>

    <target name="/noresolve" description="use to skip dependency resolution">
        <property name="no.resolve" value="true"/>
    </target>

    <target name="/notest" description="use to skip tests">
        <property name="skip.test" value="true"/>
    </target>

    <target name="/nojavadoc" description="use to skip javadoc">
        <property name="skip.javadoc" value="true"/>
    </target>

    <target name="/localivy" description="use a local ivy home">
        <property name="ivy.use.local.home" value="true"/>
    </target>

    <target name="/offline" depends="/noresolve" description="use to indicate no internet connection is available">
        <property name="offline" value="true"/>
    </target>

    <target name="default-version">
        <tstamp>
            <format property="pubdate" pattern="yyyyMMddHHmmss"/>
        </tstamp>
        <property name="version.prefix" value="${target.ivy.version}-local-"/>
        <property name="build.version" value="${version.prefix}${pubdate}"/>
        <property name="bundle.version" value="${target.ivy.bundle.version}.${target.ivy.bundle.version.qualifier}${pubdate}"/>
    </target>

    <!-- =================================================================
         DEPENDENCY MNGT, COMPILATION AND JAR
         ================================================================= -->
    <target name="resolve" depends="init-ivy" unless="no.resolve">
        <ivy:retrieve conf="default,test" pattern="${lib.dir}/[artifact].[ext]" sync="yes"/>
    </target>

    <target name="compile-core" depends="prepare">
        <javac srcdir="${src.dir}"
               destdir="${core.classes.build.dir}"
               sourcepath=""
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               includeantruntime="no">
            <excludesfile name="ant.patterns"/>
            <excludesfile name="optional.patterns"/>
        </javac>
        <copy todir="${core.classes.build.dir}" includeEmptyDirs="false">
            <fileset dir="${src.dir}">
                <exclude name="**/*.java"/>
                <excludesfile name="ant.patterns"/>
                <excludesfile name="optional.patterns"/>
            </fileset>
        </copy>

        <!-- copy settings files for backward compatibility with ivyconf naming -->
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-local.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-local.xml"/>
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-default-chain.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-default-chain.xml"/>
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-main-chain.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-main-chain.xml"/>
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-public.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-public.xml"/>
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings-shared.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf-shared.xml"/>
        <copy file="${core.classes.build.dir}/org/apache/ivy/core/settings/ivysettings.xml"
            tofile="${core.classes.build.dir}/org/apache/ivy/core/settings/ivyconf.xml"/>
    </target>

    <!-- Build the Ant tasks with the current Ant runtime -->
    <target name="compile-bootstrap" depends="compile-core">
        <javac srcdir="${src.dir}"
               destdir="${bootstrap.classes.build.dir}"
               sourcepath=""
               classpathref="build.bootstrap.classpath"
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               includeantruntime="yes">
            <includesfile name="ant.patterns"/>
        </javac>
        <copy todir="${bootstrap.classes.build.dir}" includeEmptyDirs="false">
            <fileset dir="${src.dir}">
                <includesfile name="ant.patterns"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <!-- Build the Ant tasks with the minimal Ant runtime -->
    <target name="compile-ant" depends="compile-core,resolve">
        <javac srcdir="${src.dir}"
               destdir="${ant.classes.build.dir}"
               sourcepath=""
               classpathref="build.ant.classpath"
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               includeantruntime="no">
            <includesfile name="ant.patterns"/>
        </javac>
        <copy todir="${ant.classes.build.dir}" includeEmptyDirs="false">
            <fileset dir="${src.dir}">
                <includesfile name="ant.patterns"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <target name="compile-optional" depends="compile-ant">
        <javac srcdir="${src.dir}"
               destdir="${optional.classes.build.dir}"
               sourcepath=""
               classpathref="build.optional.classpath"
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               includeantruntime="no">
            <includesfile name="optional.patterns"/>
            <includesfile name="ant.patterns"/>
        </javac>
        <copy todir="${core.classes.build.dir}" includeEmptyDirs="false">
            <fileset dir="${src.dir}">
                <includesfile name="optional.patterns"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <!-- =================================================================
         Create the two jar files (Ivy core and Ivy core + Ant tasks)
         ================================================================= -->
    <target name="jar" depends="compile-optional,default-version" description="Create Jar files">
        <!-- identify compiled ivy version -->
        <echo message="version=${build.version}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true"/>
        <echo message="date=${pubdate}${line.separator}" file="${core.classes.build.dir}/module.properties" append="true"/>

        <mkdir dir="${artifacts.build.dir}/jars/"/>

        <!--
            there is a default Bundle-Version attribute in the source MANIFEST, used to ease
            development in eclipse.
            We remove this line to make sure we get the Bundle-Version as set in the jar task
        -->
        <copy file="${basedir}/META-INF/MANIFEST.MF" tofile="${artifacts.build.dir}/MANIFEST.MF">
            <filterchain>
                <replaceregex pattern="Bundle-Version:.*" replace="Bundle-Version: ${bundle.version}" byline="true"/>
            </filterchain>
        </copy>

        <copy todir="${all.classes.build.dir}">
            <fileset dir="${core.classes.build.dir}"/>
            <fileset dir="${ant.classes.build.dir}"/>
            <fileset dir="${optional.classes.build.dir}"/>
        </copy>

        <jar destfile="${artifacts.build.dir}/jars/${final.name}"
             manifest="${artifacts.build.dir}/MANIFEST.MF">
            <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
            <manifest>
                <attribute name="Specification-Title" value="Apache Ivy with Ant tasks"/>
                <attribute name="Specification-Version" value="${build.version}"/>
                <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
                <attribute name="Implementation-Title" value="org.apache.ivy"/>
                <attribute name="Implementation-Version" value="${build.version}"/>
                <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
                <attribute name="Implementation-Vendor-Id" value="org.apache"/>
                <attribute name="Extension-name" value="org.apache.ivy"/>
                <attribute name="Build-Version" value="${build.version}"/>
            </manifest>
            <fileset dir="${all.classes.build.dir}"/>
        </jar>
        <!-- copy main jar to ease its use as an OSGi bundle -->
        <copy file="${artifacts.build.dir}/jars/${final.name}"
              tofile="${artifacts.build.dir}/org.apache.ivy_${bundle.version}.jar"/>

        <!-- clean generated module properties file -->
        <delete file="${core.classes.build.dir}/module.properties"/>
    </target>

    <!-- =================================================================
         PUBLISH LOCAL
         ================================================================= -->
    <target name="fixcrlf">
        <property name="eol.native.includes"
                  value="**/*.html,**/*.json,**/*.java,**/*.xml,**/*.txt,**/*.MF,**/*.properties,**/*.patterns,**/*.pom,**/*.xsl,**/*.css"/>
        <property name="eol.native.excludes"
                  value="build/**,bin/**,lib/**"/>

        <fileset id="eol.native.fileset"
                 dir="${basedir}"
                 includes="${eol.native.includes}"
                 excludes="${eol.native.excludes}"/>

        <fixcrlf srcdir="${basedir}"
                 includes="${eol.native.includes}"
                 excludes="${eol.native.excludes}"/>
    </target>

    <target name="sources" depends="default-version" description="Create source archive files">
        <mkdir dir="${artifacts.build.dir}/sources/"/>
        <jar destfile="${artifacts.build.dir}/sources/${final.name}">
            <metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
            <manifest>
                <attribute name="Specification-Title" value="Apache Ivy Sources"/>
                <attribute name="Specification-Version" value="${build.version}"/>
                <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
            </manifest>
            <fileset dir="${src.dir}"/>
        </jar>
    </target>

    <target name="publish-local" depends="jar,sources" description="publishes Ivy to Ivy local repository">
        <ivy:publish resolver="local" pubrevision="${build.version}"
            artifactsPattern="${artifacts.build.dir}/[type]s/[artifact].[ext]"
            forcedeliver="true"/>
    </target>

    <!-- =================================================================
         TESTS
         ================================================================= -->
    <target name="build-test" depends="jar">
        <javac srcdir="${test.dir}"
               destdir="${test.build.dir}"
               classpathref="run.classpath"
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               encoding="UTF-8"
               includeantruntime="no"/>
        <copy todir="${test.build.dir}">
            <fileset dir="${test.dir}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>

    <target name="build-custom-resolver-jar" depends="jar">
        <mkdir dir="${build.dir}/custom-classpath"/>
        <javac srcdir="${basedir}/test/custom-classpath"
               destdir="${build.dir}/custom-classpath"
               classpathref="run.classpath"
               source="${ivy.minimum.javaversion}"
               target="${ivy.minimum.javaversion}"
               debug="${debug.mode}"
               includeantruntime="no"/>
        <jar destfile="${test.dir}/org/apache/ivy/core/settings/custom-resolver.jar"
             basedir="${build.dir}/custom-classpath"/>
    </target>

    <target name="init-tests-offline" if="offline">
            <fileset id="test.fileset" dir="${test.dir}">
                <include name="**/${test.class.pattern}.java"/>
                <exclude name="**/Abstract*Test.java"/>
                <not><contains text="remote.test"/></not>
            </fileset>
    </target>

    <target name="init-tests-online" unless="offline">
            <fileset id="test.fileset" dir="${test.dir}">
                <include name="**/${test.class.pattern}.java"/>
                <exclude name="**/Abstract*Test.java"/>
            </fileset>
    </target>

    <target name="init-tests" depends="init-tests-offline,init-tests-online"/>

    <target name="prepare-osgi-tests" depends="resolve" unless="skip.test">
        <ant dir="${basedir}/test/test-repo" target="generate-bundles"/>
    </target>

    <target name="prepare-test-jar-repositories" unless="skip.test">
        <mkdir dir="${basedir}/test/jar-repos"/>
        <jar destfile="${basedir}/test/jar-repos/jarrepo1.jar" >
            <fileset dir="${basedir}/test/repositories/1"/>
        </jar>
        <jar destfile="${basedir}/test/jar-repos/jarrepo1_subdir.jar">
            <fileset dir="${basedir}/test/repositories" includes="1/**/*"/>
        </jar>
    </target>

    <target name="init-jacoco" depends="jar" unless="skip.test">
        <ivy:cachepath organisation="org.jacoco" module="org.jacoco.ant" revision="${jacoco.version}"
                       inline="true" conf="default" pathid="jacoco.classpath" log="download-only"/>
        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"
                 classpathref="jacoco.classpath"/>
    </target>

    <target name="test-internal" depends="build-test,init-tests,prepare-osgi-tests,prepare-test-jar-repositories,init-jacoco" unless="skip.test">
        <mkdir dir="${test.xml.dir}"/>

        <!-- multiple runs into the same logfile let the later report generation fail -->
        <delete file="${jacoco.log}"/>
        <property name="jacoco.coverage.enabled" value="true"/>
        <jacoco:coverage xmlns:jacoco="antlib:org.jacoco.ant" destfile="${jacoco.log}"
                         exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader"
                         enabled="${jacoco.coverage.enabled}">
            <junit
                haltonfailure="off"
                haltonerror="off"
                errorproperty="test.failed"
                failureproperty="test.failed"
                showoutput="no"
                printsummary="yes"
                includeantruntime="no"
                dir="${basedir}"
                tempdir="${build.dir}"
                fork="true">
                <classpath>
                    <path refid="test.classpath"/>
                </classpath>

                <!-- pass the proxy properties to the forked junit process to use correct proxy -->
                <syspropertyset>
                    <propertyref prefix="http"/>
                </syspropertyset>

                <!-- Added this to test IVY-65 -->
                <jvmarg value="-Duser.region=TR"/>
                <jvmarg value="-Duser.language=tr"/>

                <formatter type="xml"/>
                <batchtest todir="${test.xml.dir}">
                    <fileset refid="test.fileset"/>
                </batchtest>
            </junit>
        </jacoco:coverage>
    </target>

    <target name="test" depends="test-internal" description="Run the test">
        <fail if="test.failed"
              message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)"/>
    </target>

    <!-- =================================================================
         REPORTS AND DOCUMENTATION
         ================================================================= -->
    <target name="test-report" depends="test-internal" unless="skip.test"
            description="run tests with instrumentation and generate coverage report">
        <junitreport todir="${test.xml.dir}">
            <fileset dir="${test.xml.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${test.report.dir}"/>
        </junitreport>

        <mkdir dir="${coverage.report.dir}"/>
        <jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
            <executiondata>
                <file file="${jacoco.log}"/>
            </executiondata>

            <structure name="Ivy">
                <classfiles>
                    <fileset dir="${classes.build.dir}"/>
                </classfiles>
                <sourcefiles encoding="UTF-8">
                    <fileset dir="${src.dir}"/>
                </sourcefiles>
            </structure>

            <html destdir="${coverage.report.dir}"/>
        </jacoco:report>

        <fail if="test.failed"
              message="At least one test has failed. See logs (in ${test.xml.dir}) or report (in ${test.report.dir})"/>
    </target>

    <target name="coverage-report" depends="test-report"/>

    <target name="ivy-report" depends="resolve">
        <mkdir dir="${ivy.report.dir}"/>
        <ivy:report todir="${ivy.report.dir}"/>
    </target>

    <target name="init-japicmp" depends="jar" unless="skip.test">
        <ivy:cachepath organisation="com.github.siom79.japicmp" module="japicmp-ant-task" revision="0.13.0"
                       inline="true" conf="default" pathid="japicmp.classpath" log="download-only"/>
        <taskdef uri="antlib:japicmp.ant" resource="japicmp/ant/antlib.xml"
                 classpathref="japicmp.classpath"/>
        <ivy:cachepath organisation="org.apache.ivy" module="ivy" revision="${ivy.api.reference}"
                       inline="true" conf="optional" pathid="ivyrefdeps.classpath" log="download-only"/>
        <ivy:cachefileset organisation="org.apache.ivy" module="ivy" revision="${ivy.api.reference}"
                          inline="true" conf="master" setid="ivyref.fileset" log="download-only"/>
        <pathconvert property="ivyref.name" refid="ivyref.fileset"/>
    </target>

    <target name="/japicmp-all" description="report status of all public APIs">
        <property name="japicmp.all" value="true"/>
    </target>

    <target name="/japicmp-changed" description="report all changed public APIs">
        <property name="japicmp.changed" value="true"/>
    </target>

    <target name="japicmp" depends="init-japicmp" unless="skip.test">
        <property name="japicmp.all" value="false"/>
        <property name="japicmp.changed" value="false"/>
        <condition property="japicmp.binary" value="true" else="false">
            <not>
                <or>
                    <istrue value="${japicmp.all}"/>
                    <istrue value="${japicmp.changed}"/>
                </or>
            </not>
        </condition>
        <japicmp:japicmp xmlns:japicmp="antlib:japicmp.ant"
                         oldjar="${ivyref.name}"
                         newjar="${artifacts.build.dir}/jars/${final.name}"
                         oldclasspathref="ivyrefdeps.classpath"
                         newclasspathref="lib.classpath"
                         onlybinaryincompatible="${japicmp.binary}"
                         onlymodified="${japicmp.changed}"
                         htmloutputfile="${reports.dir}/japicmp.html"/>
    </target>

    <target name="javadoc" depends="init" unless="skip.javadoc">
        <tstamp>
            <format pattern="2007-yyyy" property="years"/>
        </tstamp>
        <property name="copyright" value="Copyright &amp;copy;${years} The Apache Software Foundation, Licensed under &lt;a href=&quot;https://www.apache.org/licenses/LICENSE-2.0.txt&quot;&gt;Apache License, Version 2.0&lt;/a&gt;."/>
        <property name="title" value="Apache Ivy&amp;trade; dependency manager ${target.ivy.version} API"/>
        <javadoc destdir="${javadoc.build.dir}"
                 useexternalfile="true"
                 windowtitle="Apache Ivy&amp;trade;"
                 doctitle="${title}"
                 bottom="${copyright}"
                 classpathref="lib.classpath">
            <fileset dir="${src.dir}" includes="**/*.java"/>
            <arg value="-tag"/>
            <arg value="pre:a:Precondition:"/>
        </javadoc>
    </target>

    <target name="javadoc-test" depends="init" unless="skip.javadoc">
        <tstamp>
            <format pattern="2007-yyyy" property="years"/>
        </tstamp>
        <property name="copyright" value="Copyright &amp;copy;${years} The Apache Software Foundation, Licensed under &lt;a href=&quot;https://www.apache.org/licenses/LICENSE-2.0.txt&quot;&gt;Apache License, Version 2.0&lt;/a&gt;."/>
        <property name="title" value="Apache Ivy&amp;trade; dependency manager ${target.ivy.version} API"/>
        <javadoc destdir="${test.javadoc.build.dir}"
                 useexternalfile="true"
                 windowtitle="Apache Ivy&amp;trade;"
                 doctitle="${title}"
                 bottom="${copyright}"
                 classpathref="javadoc.test.classpath">
            <fileset dir="${test.dir}" includes="**/*.java"/>
        </javadoc>
    </target>

    <target name="init-checkstyle" depends="jar">
        <ivy:cachepath organisation="com.puppycrawl.tools" module="checkstyle" revision="6.19"
                       inline="true" conf="default" pathid="checkstyle.classpath" log="download-only"/>
        <taskdef uri="antlib:com.puppycrawl.tools.checkstyle.ant"
                 resource="com/puppycrawl/tools/checkstyle/ant/antlib.xml" classpathref="checkstyle.classpath"/>
    </target>

    <!-- Checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config  -->
    <target name="checkstyle-internal" depends="init-checkstyle">
        <mkdir dir="${checkstyle.report.dir}"/>
        <cs:checkstyle xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant"
                       config="${checkstyle.src.dir}/checkstyle-config"
                       failOnViolation="false" failureProperty="checkstyle.failed">
            <classpath>
                <path refid="run.classpath"/>
            </classpath>
            <formatter type="xml" toFile="${checkstyle.report.dir}/checkstyle.xml"/>
            <fileset dir="${src.dir}">
                <include name="**/*.java"/>
            </fileset>
            <fileset dir="${example.dir}">
                <include name="**/*.java"/>
            </fileset>
        </cs:checkstyle>
    </target>

    <target name="checkstyle" depends="checkstyle-internal"
            description="checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config">
        <fail if="checkstyle.failed" unless="ignore.checkstyle"
              message="Checkstyle has errors. See report in ${checkstyle.report.dir}"/>
    </target>

    <target name="checkstyle-report" depends="checkstyle-internal">
        <property name="checkstyle.basedir" location="${src.dir}"/>
        <xslt in="${checkstyle.report.dir}/checkstyle.xml"
              style="${checkstyle.src.dir}/checkstyle-frames.xsl"
              out="${checkstyle.report.dir}/output.txt">
            <param name="basedir" expression="${checkstyle.basedir}"/>
            <param name="output.dir" expression="${checkstyle.report.dir}"/>
        </xslt>
    </target>

    <target name="init-findbugs" unless="findbugs.home">
        <!-- Findbugs: Getting Findbugs requires unlimited strength crypto policy -->
        <property name="findbugs.version"
                  value="3.0.1"
                  description="Version of Findbugs to use"/>
        <property name="findbugs.download.name"
                  value="findbugs-${findbugs.version}"
                  description="Name of the download file without suffix. Also the internal root directory of the ZIP."/>
        <property name="findbugs.download.file"
                  value="${findbugs.download.name}.zip"
                  description="The filename of the ZIP."/>
        <property name="findbugs.download.url"
                  value="https://downloads.sourceforge.net/project/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.zip"
                  description="The download adress at a mirror of Sourceforge."/>
        <property name="findbugs.download.to"
                  value="${build.dir}/.downloads"
                  description="Where to store the download and 'install' Findbugs."/>
        <available property="findbugs.home"
                   value="${findbugs.download.to}/${findbugs.download.name}"
                   file="${findbugs.download.to}/${findbugs.download.name}/lib/findbugs.jar"
                   description="Check if Findbugs is already installed."/>

        <!-- Findbugs: Running Findbugs -->
        <property name="findbugs.reportdir"
                  location="${reports.dir}/findbugs"
                  description="Where to store Findbugs results"/>
        <property name="findbugs.raw"
                  value="raw.xml"
                  description="Findbugs output xml file"/>
        <property name="findbugs.xsl"
                  value="fancy.xsl"
                  description="Which XSL to use for generating output: default, fancy, plain, summary"/>
        <property name="findbugs.jvmargs"
                  value="-Xms128m -Xmx512m"
                  description="JVMArgs for invoking Findbugs"/>

        <mkdir dir="${findbugs.download.to}"/>
        <get src="${findbugs.download.url}" dest="${findbugs.download.to}/${findbugs.download.file}"
             usetimestamp="true" skipexisting="true"/>
        <unzip src="${findbugs.download.to}/${findbugs.download.file}" dest="${findbugs.download.to}"/>
        <property name="findbugs.home" location="${findbugs.download.to}/${findbugs.download.name}"/>
    </target>

    <target name="findbugs" description="checks Ivy codebase with Findbugs" depends="init-findbugs,compile-core" xmlns:fb="http://findbugs.sourceforge.net/">
        <!-- Load the Findbugs AntTasks -->
        <path id="findbugs.real.classpath">
            <fileset dir="${findbugs.home}/lib" includes="*.jar"/>
        </path>
        <taskdef uri="http://findbugs.sourceforge.net/" resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpathref="findbugs.real.classpath"/>

        <!-- Start Findbugs -->
        <mkdir dir="${findbugs.reportdir}"/>
        <fb:findbugs home="${findbugs.home}"
                     classpathref="findbugs.real.classpath"
                     output="xml:withMessages"
                     outputFile="${findbugs.reportdir}/${findbugs.raw}"
                     jvmargs="${findbugs.jvmargs}"
                     projectName="${ant.project.name} ${target.ivy.version}">
            <class location="${core.classes.build.dir}"/>
            <sourcePath path="${src.dir}"/>
        </fb:findbugs>

        <!-- Generate (human) readable output -->
        <xslt basedir="${findbugs.reportdir}" includes="${findbugs.raw}" destdir="${findbugs.reportdir}">
            <style>
                <javaresource name="${findbugs.xsl}" classpathref="findbugs.real.classpath"/>
            </style>
        </xslt>
    </target>

    <target name="docs" depends="test-report,checkstyle-report,findbugs,japicmp,ivy-report,javadoc"/>

    <!-- =================================================================
         IDE SPECIFIC
         ================================================================= -->
    <available file="${basedir}/.classpath" property="eclipse.classpath.exists"/>
    <target name="check-eclipse-classpath-overwrite" if="eclipse.classpath.exists">
        <input message=".classpath file already exists.${line.separator}Are you sure you want to overwrite it and loose your original file?"
               validargs="Y,N,y,n" addproperty="eclipse.classpath.confirm"/>
        <condition property="eclipse.classpath.abort">
            <equals arg1="${eclipse.classpath.confirm}" arg2="N" casesensitive="false"/>
        </condition>
    </target>

    <target name="eclipse-default" depends="resolve,check-eclipse-classpath-overwrite"
            unless="eclipse.classpath.abort"
            description="creates a default .classpath for Eclipse using jars resolved by this Ant build">
        <copy file="${basedir}/.classpath.default" tofile="${basedir}/.classpath" overwrite="true"/>
    </target>

    <target name="eclipse-ivyde" depends="check-eclipse-classpath-overwrite"
            unless="eclipse.classpath.abort"
            description="creates a .classpath for Eclipse using Apache IvyDE plugin">
        <copy file="${basedir}/.classpath.ivyde" tofile="${basedir}/.classpath" overwrite="true"/>
    </target>
</project>