This repository has been archived by the owner on Feb 6, 2021. It is now read-only.
forked from rimerosolutions/ant-git-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
657 lines (572 loc) · 31.5 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2013 Rimero Solutions
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:git="antlib:com.rimerosolutions.ant.git"
xmlns:wrapper="antlib:com.rimerosolutions.ant.wrapper.tasks"
xmlns:au="antlib:org.apache.ant.antunit"
xmlns:jacoco="antlib:org.jacoco.ant"
xmlns:findbugs="antlib:edu.umd.cs.findbugs"
name="ant-git-tasks"
default="jar">
<!-- reuse the user's gradle properties if any for sensitive info such as gpg, credentials -->
<property file="${user.home}/.gradle/gradle.properties"/>
<property file="${basedir}/properties/build.properties"/>
<!-- release and version properties -->
<property name="release.properties.filename" value="${basedir}/properties/release.properties"/>
<property file="${release.properties.filename}"/>
<property name="build.number" value="${build.major.number}.${build.minor.number}.${build.revision.number}"/>
<condition property="project.version.classifier" value="-SNAPSHOT">
<equals casesensitive="true" arg1="${snapshot}" arg2="true"/>
</condition>
<property name="project.version.classifier" value=""/>
<property name="project.version" value="${build.number}${project.version.classifier}"/>
<!-- general folders and files properties -->
<property name="src.dir" value="src/main/java"/>
<property name="test.src.dir" value="src/test/java"/>
<property name="resources.dir" value="src/main/resources"/>
<property name="test.resources.dir" value="src/test/resources"/>
<property name="target.dir" value="target"/>
<property name="test.data.dir" value="${java.io.tmpdir}/ant-git-tasks"/>
<property name="dist.dir" value="dist"/>
<property name="docs.dir" value="${target.dir}/docs"/>
<property name="apidocs.dir" value="${docs.dir}/apidocs"/>
<property name="antdocs.dir" value="${docs.dir}/antdocs"/>
<property name="jacoco.data.filename" value="jacoco.exec"/>
<property name="jacoco.data.file" value="${test.data.dir}/${jacoco.data.filename}"/>
<property name="javadoc.overview.html" value="${resources.dir}/com/rimerosolutions/ant/git/overview.html"/>
<property name="antdoc.overview.html" value="${resources.dir}/com/rimerosolutions/ant/git/antdoc.overview.html"/>
<property name="company.name" value="Rimero Solutions Inc."/>
<property name="product.description" value="Apache Ant Git tasks"/>
<property name="template.pom.location" value="templates/pom.xml"/>
<!-- reports -->
<property name="reports.dir" value="${target.dir}/reports"/>
<property name="reports.junit.dir" value="${reports.dir}/junit"/>
<property name="reports.junit.xml.dir" value="${reports.junit.dir}/xml"/>
<property name="reports.junit.html.dir" value="${reports.junit.dir}/html"/>
<property name="reports.findbugs.dir" value="${reports.dir}/findbugs"/>
<property name="reports.jacoco.dir" value="${reports.dir}/jacoco"/>
<!-- classes -->
<property name="classes.dir" value="${target.dir}/classes"/>
<property name="test.classes.dir" value="${target.dir}/testClasses"/>
<property name="lib.dir" value="lib"/>
<!-- javac properties -->
<property name="javac.source" value="1.7"/>
<property name="javac.target" value="1.7"/>
<property name="javac.debug" value="true" />
<property name="javac.debuglevel" value="lines,vars,source" />
<property name="javac.encoding" value="utf-8" />
<!-- bountycastle properties, ivy signing with pgp, git tasks self-bootstrapping -->
<property name="bountycastle.version" value="1.45"/>
<property name="bountycastle.classifier" value="jdk16"/>
<property name="bcpg.jar.file" value="bcpg-${bountycastle.classifier}-${bountycastle.version}.jar"/>
<property name="bcprov.jar.file" value="bcprov-${bountycastle.classifier}-${bountycastle.version}.jar"/>
<!-- wrapper file name properties -->
<property name="unix.wrapper.file" value="antw"/>
<property name="windows.wrapper.file" value="antw.bat"/>
<property name="windows.wrapper.cmd" value="antw.cmd"/>
<property name="windows.wrapper.helper" value="lcp.bat"/>
<property name="wrapper.dir" value="wrapper"/>
<!-- ivy properties -->
<property name="ivy.install.version" value="2.3.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivyxml.file" value="${basedir}/ivy.xml"/>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.lib.dir" value="${lib.dir}"/>
<!-- maven repositories, resolvers in ivysettings.xml -->
<property name="maven.repo.local" value="local-m2"/>
<property name="maven.repo.sonatype.releases" value="sonatype-releases"/>
<property name="maven.repo.sonatype.snapshots" value="sonatype-snapshots"/>
<!-- sonatype deployment conditions -->
<condition property="sonatype.deployment.enabled">
<and>
<isset property="signing.keyId"/>
<isset property="signing.password"/>
<isset property="signing.name"/>
<isset property="signing.secretKeyRingFile"/>
<isset property="sonatype.username"/>
<isset property="sonatype.password"/>
</and>
</condition>
<condition property="sonatype.deployment.snapshots.enabled">
<and>
<isset property="sonatype.deployment.enabled"/>
<equals casesensitive="false" arg1="${snapshot}" arg2="true"/>
</and>
</condition>
<condition property="sonatype.deployment.releases.enabled">
<not>
<isset property="sonatype.deployment.snapshots.enabled"/>
</not>
</condition>
<tstamp>
<format property="build.current.time" pattern="yyyyMMdd_HHmmss" />
</tstamp>
<property environment="env."/>
<property name="jdk-tools.jar" value="${env.JAVA_HOME}/lib/tools.jar"/>
<echo>Ant Git Tasks ${project.version} Build.</echo>
<!-- ****************************************** -->
<!-- release -->
<!-- ****************************************** -->
<property name="release.properties.filename" value="release.properties"/>
<property file="${release.properties.filename}"/>
<property name="build.number" value="${build.major.number}.${build.minor.number}.${build.revision.number}"/>
<condition property="snapshot-build">
<and>
<isset property="snapshot"/>
<equals arg1="true" arg2="${snapshot}"/>
</and>
</condition>
<target name="release-prepare-fix" description="Release for backwards-compatible bug fixes">
<propertyfile file="${release.properties.filename}">
<entry key="build.revision.number" type="int" operation="+" value="1" pattern="0"/>
</propertyfile>
</target>
<target name="release-prepare-feature" description="Release for added functionality in a backwards-compatible manner">
<propertyfile file="${release.properties.filename}">
<entry key="build.minor.number" type="int" operation="+" value="1" pattern="0"/>
<entry key="build.revision.number" type="int" value="0" pattern="0"/>
</propertyfile>
</target>
<target name="release-prepare-major" description="Release for incompatible API changes">
<propertyfile file="${release.properties.filename}">
<entry key="build.major.number" type="int" operation="+" value="1" pattern="0"/>
<entry key="build.minor.number" type="int" value="0" pattern="0"/>
<entry key="build.revision.number" type="int" value="0" pattern="0"/>
</propertyfile>
</target>
<target name="-git-settings" depends="compile">
<!-- bootstrap the ant-git-tasks release process with a snapshot of itself for now... -->
<path id="bootstrap.classpath">
<path refid="compile.classpath"/>
<path location="${classes.dir}"/>
</path>
<taskdef uri="antlib:com.rimerosolutions.ant.git"
resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml">
<classpath refid="bootstrap.classpath"/>
</taskdef>
<git:settings refId="github.settings"
username="${github.username}"
password="${github.password}"
name="${github.name}"
email="${github.email}"/>
</target>
<target name="-pre-release" depends="-git-settings">
<echo>Checking tree modifications before release.</echo>
<git:git directory="${basedir}" verbose="true">
<git:uptodate modificationExistProperty="tree.modified" failOnError="false"/>
</git:git>
<condition property="tree.modified.but.not.snapshot">
<and>
<isset property="tree.modified"/>
<not><isset property="snapshot-build"/></not>
</and>
</condition>
</target>
<target name="-check-release" depends="-pre-release" if="snapshot-build">
<fail if="tree.modified">The git tree is not up to date.</fail>
</target>
<target name="-commit-release" depends="-check-release" if="tree.modified.but.not.snapshot">
<echo>Committing before release SCM tagging.</echo>
<git:git directory="${basedir}" verbose="true" settingsRef="github.settings">
<git:commit message="[${ant.project.name}] Preparing release ${project.version}"/>
<git:uptodate failOnError="true"/>
<git:push />
</git:git>
</target>
<target name="-tag-release" depends="-commit-release" unless="snapshot-build">
<echo>Tagging release ${build.number}.</echo>
<git:git directory="${basedir}" verbose="true" settingsRef="github.settings">
<git:tag name="${build.number}"/>
<git:push />
</git:git>
</target>
<target name="release-perform" depends="-tag-release" description="Perform a release"/>
<!-- ****************************************** -->
<!-- ivy -->
<!-- ****************************************** -->
<target name="-bootstrap-build" unless="offline">
<echo>Fetching ivy.</echo>
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}"
usetimestamp="true"/>
<echo>Fetching gpg signing libraries.</echo>
<!-- bootstrap ivy gpg signing -->
<get src="http://repo1.maven.org/maven2/org/bouncycastle/bcprov-${bountycastle.classifier}/${bountycastle.version}/${bcprov.jar.file}"
dest="${ivy.jar.dir}/${bcprov.jar.file}"
usetimestamp="true"/>
<get src="http://repo1.maven.org/maven2/org/bouncycastle/bcpg-${bountycastle.classifier}/${bountycastle.version}/${bcpg.jar.file}"
dest="${ivy.jar.dir}/${bcpg.jar.file}"
usetimestamp="true"/>
</target>
<target name="-init-ivy" depends="-bootstrap-build">
<echo>Initializing Apache Ivy.</echo>
<!-- try to load ivy here from ivy home, 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 local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path"/>
</target>
<target name="-resolve" depends="-init-ivy">
<echo>Fetching dependencies.</echo>
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]" sync="true" log="quiet"/>
<ivy:cachepath pathid="compile.classpath" conf="compile"/>
<ivy:cachepath pathid="test.classpath" conf="test"/>
<ivy:cachepath pathid="findbugs.classpath" conf="findbugs"/>
<ivy:cachepath pathid="jacoco.classpath" conf="jacoco"/>
<ivy:cachepath pathid="wrapper.classpath" conf="wrapper"/>
</target>
<!-- ****************************************** -->
<!-- general -->
<!-- ****************************************** -->
<target name="init" depends="-resolve" description="Create build folder layout">
<echo>Setting up build layout.</echo>
<!-- no old git test data in your data folder -->
<delete dir="${test.data.dir}" quiet="true"/>
<mkdir dir="${target.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${apidocs.dir}"/>
<mkdir dir="${antdocs.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${test.classes.dir}"/>
<mkdir dir="${test.data.dir}"/>
<mkdir dir="${reports.dir}"/>
<mkdir dir="${reports.junit.xml.dir}"/>
<mkdir dir="${reports.junit.html.dir}"/>
<mkdir dir="${reports.findbugs.dir}"/>
<mkdir dir="${reports.jacoco.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="clean" description="Cleanup build">
<echo>Cleaning up build.</echo>
<delete dir="${target.dir}" quiet="true"/>
<delete dir="${lib.dir}" quiet="true"/>
<delete dir="${target.dir}" quiet="true"/>
<delete dir="${dist.dir}" quiet="true"/>
<delete dir="${test.data.dir}" quiet="true"/>
</target>
<target name="compile" depends="init" description="Compile sources">
<echo>Compiling sources.</echo>
<javac source="${javac.source}"
target="${javac.target}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
encoding="${javac.encoding}"
destdir="${classes.dir}"
includeantruntime="false">
<src path="${src.dir}"/>
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${jdk-tools.jar}"/>
</classpath>
</javac>
<echo>Copying project resources.</echo>
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}"/>
</copy>
</target>
<!-- ****************************************** -->
<!-- testing -->
<!-- ****************************************** -->
<target name="compile-tests" depends="compile" description="Compile test sources">
<echo>Compiling test sources.</echo>
<javac source="${javac.source}"
target="${javac.target}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
encoding="${javac.encoding}"
destdir="${test.classes.dir}"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
<src path="${test.src.dir}"/>
<classpath>
<path refid="test.classpath"/>
<path refid="compile.classpath"/>
<path location="${classes.dir}"/>
<pathelement location="${jdk-tools.jar}"/>
</classpath>
</javac>
</target>
<target name="-junit-tests" depends="compile-tests" >
<echo>Running junit tests.</echo>
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
classpathref="test.classpath"/>
<taskdef uri="antlib:org.jacoco.ant"
resource="org/jacoco/ant/antlib.xml"
classpathref="jacoco.classpath"/>
<jacoco:coverage output="file" destfile="${jacoco.data.file}">
<junit fork="true"
dir="${basedir}"
printsummary="yes"
showoutput="true"
haltonfailure="false"
errorproperty="junit.failed"
includeantruntime="false">
<classpath location="${test.classes.dir}"/>
<classpath location="${classes.dir}"/>
<classpath refid="test.classpath"/>
<classpath refid="compile.classpath"/>
<formatter type="xml"/>
<batchtest todir="${reports.junit.xml.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</target>
<target name="-antunit-tests" depends="-junit-tests">
<echo>Running antunit tests.</echo>
<taskdef uri="antlib:org.apache.ant.antunit"
resource="org/apache/ant/antunit/antlib.xml"
classpathref="test.classpath"/>
<path id="classes.location">
<pathelement location="${classes.dir}"/>
</path>
<path id="testData.location">
<pathelement location="${test.data.dir}"/>
</path>
<copy todir="${test.data.dir}" overwrite="true">
<fileset dir="${test.resources.dir}" includes="*.txt"/>
</copy>
<au:antunit failonerror="false" errorproperty="antunit.failed">
<referenceset>
<reference refid="compile.classpath"/>
<reference refid="classes.location"/>
<reference refid="testData.location"/>
</referenceset>
<fileset dir="${test.resources.dir}" includes="*.xml"/>
<au:plainlistener/>
<au:xmllistener todir="${reports.junit.xml.dir}"/>
</au:antunit>
</target>
<target name="test" depends="-junit-tests,-antunit-tests" description="Run all unit tests">
<condition property="test.passed">
<and>
<not><isset property="junit.failed"/></not>
<not><isset property="antunit.failed"/></not>
</and>
</condition>
</target>
<!-- ****************************************** -->
<!-- code quality -->
<!-- ****************************************** -->
<target name="report-findbugs" depends="compile" description="Generate FindBugs report">
<echo>Generating FindBugs report.</echo>
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
uri="antlib:edu.umd.cs.findbugs"
classpathref="findbugs.classpath"/>
<findbugs:findbugs classpath="findbugs.classpath"
classpathref="findbugs.classpath"
workHard="true"
jvmargs="-Xmx512m -Xms512m"
output="html"
outputFile="${reports.findbugs.dir}/index.html"
stylesheet="default.xsl">
<auxAnalyzePath>
<pathelement location="${jdk-tools.jar}"/>
<fileset dir="${lib.dir}" includes="**/*annotation*.jar"/>
</auxAnalyzePath>
<auxClasspath refid="compile.classpath"/>
<sourcePath path="${src.dir}" />
<class location="${classes.dir}" />
</findbugs:findbugs>
</target>
<target name="report-junit" depends="test" description="Generate JUnit report">
<echo>Generating JUnit report.</echo>
<junitreport todir="${reports.junit.dir}">
<fileset dir="${reports.junit.xml.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports.junit.html.dir}"/>
</junitreport>
</target>
<target name="report-jacoco" depends="test" description="Generate Jacoco report">
<echo>Generating Jacoco report.</echo>
<jacoco:report>
<executiondata>
<file file="${jacoco.data.file}"/>
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${classes.dir}">
<include name="**/*.class"/>
</fileset>
</classfiles>
<sourcefiles>
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
</sourcefiles>
</structure>
<html destdir="${reports.jacoco.dir}"/>
</jacoco:report>
</target>
<target name="reports" depends="report-findbugs,report-junit,report-jacoco"
description="Generate reports(JUnit, FindBugs, Jacoco)">
<fail unless="test.passed">Some tests failed, please take a look at the reports.</fail>
</target>
<!-- ****************************************** -->
<!-- build artifacts -->
<!-- ****************************************** -->
<target name="jar" depends="compile" description="Create main jar artefact">
<echo>Building jar.</echo>
<jar destfile="${dist.dir}/${ant.project.name}.jar">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${build.current.time}"/>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${project.version}"/>
<attribute name="Implementation-Vendor" value="${company.name}"/>
</manifest>
<fileset dir="${classes.dir}"/>
</jar>
</target>
<target name="-javadoc" depends="compile">
<echo>Generating Javadoc documentation.</echo>
<javadoc packagenames="**/*.*"
sourcepath="${src.dir}"
defaultexcludes="yes"
destdir="${apidocs.dir}"
overview="${javadoc.overview.html}"
author="true"
version="true"
use="true"
windowtitle="${product.description}">
<tag name="antdoc.notrequired" description="Non required attribute for the Ant task"/>
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${jdk-tools.jar}"/>
</classpath>
<doctitle><![CDATA[<h1>Ant Git Tasks API</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2013 Rimero Solutions Inc. All Rights Reserved.</i>]]></bottom>
<link href="http://download.oracle.com/javase/6/docs/api/" />
<link href="http://download.eclipse.org/jgit/docs/latest/apidocs/" />
<link href="http://javadoc.haefelinger.it/org.apache.ant/1.7.1/"/>
</javadoc>
</target>
<target name="-antdoc" depends="compile">
<echo>Generating Ant tasks documentation.</echo>
<path id="antdoc.classpath">
<path refid="compile.classpath"/>
<pathelement location="${jdk-tools.jar}"/>
<path location="${classes.dir}"/>
</path>
<javadoc packagenames="**/*.*" sourcepath="${src.dir}"
destdir="${antdocs.dir}"
overview="${antdoc.overview.html}"
doctitle="Ant Git Tasks documentation"
header="Ant Git tasks usage."
bottom="Copyright 2013, Rimero Solutions"
doclet="com.rimerosolutions.ant.git.AntTaskDoclet"
docletpathref="antdoc.classpath"
defaultexcludes="yes">
<classpath>
<path refid="antdoc.classpath"/>
</classpath>
</javadoc>
</target>
<target name="javadoc" depends="-javadoc,-antdoc" description="Generate javadocs"/>
<target name="jar-sources" depends="compile" description="Generate sources jar">
<echo>Generating sources jar.</echo>
<zip destfile="${dist.dir}/${ant.project.name}-sources.jar">
<zipfileset dir="${src.dir}" />
<zipfileset dir="${resources.dir}" />
</zip>
</target>
<target name="jar-javadoc" depends="javadoc" description="Generate javadocs jar">
<echo>Generating sources jar.</echo>
<zip destfile="${dist.dir}/${ant.project.name}-javadoc.jar">
<zipfileset dir="${apidocs.dir}" />
</zip>
</target>
<target name="build"
depends="jar,jar-javadoc,jar-sources,reports"
description="Create the jar and generate build reports"/>
<!-- ****************************************** -->
<!-- maven related -->
<!-- ****************************************** -->
<macrodef name="maven-publish" description="Macro to publish to Maven repositories based on a provided Ivy resolver">
<attribute name="mavenRepoId"/>
<sequential>
<echo>Publishing build artifacts to your Maven repository with id @{mavenRepoId}.</echo>
<ivy:publish resolver="@{mavenRepoId}"
pubrevision="${project.version}"
overwrite="true"
forcedeliver="true"
publishivy="true">
<artifacts pattern="${dist.dir}/[artifact](-[classifier]).[ext]" />
</ivy:publish>
</sequential>
</macrodef>
<target name="maven-pom"
depends="build"
description="Generate the Maven POM for artifacts publishing">
<echo>Generating Maven POM.</echo>
<ivy:makepom ivyfile="${ivyxml.file}"
description="${product.description}"
templatefile="${template.pom.location}"
pomfile="${dist.dir}/${ant.project.name}.pom">
<mapping conf="compile" scope="compile"/>
<mapping conf="test" scope="test"/>
</ivy:makepom>
</target>
<target name="maven-publish-local"
depends="maven-pom"
description="Publish build artifacts to the local Maven repository">
<maven-publish mavenRepoId="${maven.repo.local}"/>
</target>
<target name="-maven-publish-sonatype-release"
depends="maven-pom,release-perform"
if="sonatype.deployment.releases.enabled">
<maven-publish mavenRepoId="${maven.repo.sonatype.releases}"/>
</target>
<target name="-maven-publish-sonatype-snapshots"
depends="maven-pom,release-perform"
if="sonatype.deployment.snapshots.enabled">
<maven-publish mavenRepoId="${maven.repo.sonatype.snapshots}"/>
</target>
<target name="maven-publish-remote"
depends="-maven-publish-sonatype-release,-maven-publish-sonatype-snapshots"
description="Publish build artifacts to the Sonatype Snapshots repository"/>
<!-- ****************************************** -->
<!-- wrapper related -->
<!-- ****************************************** -->
<target name="wrapper" depends="-resolve" description="Generate Ant wrapper">
<taskdef uri="antlib:com.rimerosolutions.ant.wrapper.tasks"
resource="com/rimerosolutions/ant/wrapper/tasks/antlib.xml"
classpathref="wrapper.classpath"/>
<wrapper:wrapper/>
</target>
<target name="wrapper-clean" description="Removes Ant wrapper files">
<delete dir="${wrapper.dir}" quiet="true"/>
<delete file="${unix.wrapper.file}" quiet="true"/>
<delete file="${windows.wrapper.file}" quiet="true"/>
<delete file="${windows.wrapper.cmd}" quiet="true"/>
<delete file="${windows.wrapper.helper}" quiet="true"/>
</target>
</project>