-
Notifications
You must be signed in to change notification settings - Fork 117
/
build-release.xml
637 lines (562 loc) · 34.5 KB
/
build-release.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
<!--
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="IvyRelease" default="snapshot"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:ivy2="antlib:org.apache.ivy.ant_2"
xmlns:asciidoctor="antlib:org.asciidoctor.ant"
xmlns:openpgp="antlib:org.apache.commons.openpgp.ant">
<import file="build.xml"/>
<macrodef name="run-tutorial">
<attribute name="antfile"/>
<attribute name="output"/>
<attribute name="target" default=""/>
<attribute name="failonerror" default="true"/>
<sequential>
<echo>Running @{antfile} @{target} > @{output}</echo>
<local name="antfile.dir"/>
<dirname property="antfile.dir" file="@{antfile}"/>
<local name="antfile.name"/>
<basename property="antfile.name" file="@{antfile}"/>
<echo file="@{output}">[ivy@apache:${antfile.dir}]$ ant -f ${antfile.name} @{target}${line.separator}</echo>
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true"
failonerror="@{failonerror}"
logerror="true"
append="true"
output="@{output}">
<classpath>
<fileset file="${artifacts.build.dir}/jars/${final.name}"/>
<!--
We need to set the classpath like this, otherwise the invoked
build scripts are not capable of compiling sources ???
-->
<path path="${java.class.path}"/>
</classpath>
<sysproperty key="ivy.cache.dir" value="${tutorial.cache}"/>
<sysproperty key="ivy.local.default.root" value="${tutorial.local-repo}"/>
<sysproperty key="ivy.cache.ttl.default" value="1s"/>
<sysproperty key="skip.download" value="true"/>
<arg line="-f @{antfile}"/>
<arg line="@{target}"/>
</java>
</sequential>
</macrodef>
<target name="generate-tutorial-output" depends="jar" unless="skip.generate-tutorial-output">
<property name="output.dir" value="${basedir}/asciidoc/tutorial/log"/>
<delete dir="${output.dir}"/>
<mkdir dir="${output.dir}"/>
<!-- create a copy of the tutorials so we can easily get rid of the generated files -->
<property name="tutorial.src.dir" value="${build.dir}/examples"/>
<delete dir="${tutorial.src.dir}"/>
<mkdir dir="${tutorial.src.dir}"/>
<copy todir="${tutorial.src.dir}">
<fileset dir="src/example"/>
</copy>
<!-- create a cache and local-repository for the tutorials -->
<property name="tutorial.build.dir" value="${build.dir}/tutorial"/>
<property name="tutorial.cache" value="${tutorial.build.dir}/cache"/>
<property name="tutorial.local-repo" value="${tutorial.build.dir}/local"/>
<!-- go-ivy : not logged, but run in order to check if it still run -->
<run-tutorial antfile="${tutorial.src.dir}/go-ivy/build.xml" output="${output.dir}/dummy.txt"/>
<delete file="${output.dir}/dummy.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- hello-ivy : Quick Start - start.html -->
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-1.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/hello-ivy/build.xml" output="${output.dir}/hello-ivy-2.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- multiple resolvers - multiple.html -->
<run-tutorial antfile="${tutorial.src.dir}/chained-resolvers/chainedresolvers-project/build.xml" output="${output.dir}/chained-resolvers.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- dual - dual.html -->
<run-tutorial antfile="${tutorial.src.dir}/dual/project/build.xml" output="${output.dir}/dual.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- Project dependencies - multi-project.html -->
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/dependence/dependee/build.xml" target="publish" output="${output.dir}/dependence-standalone-2.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/dependence/depender/build.xml" output="${output.dir}/dependence-depending-2.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- configuration - Using Ivy Configuration - conf.html -->
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/filter-framework/build.xml" output="${output.dir}/configurations-lib.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" output="${output.dir}/configurations-runcc.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/configurations/multi-projects/myapp/build.xml" target="run-hm" output="${output.dir}/configurations-runhm.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!--Building a repository - basic.html -->
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2" output="${output.dir}/install.txt"/>
<pathconvert property="myrepository.content" pathsep="${line.separator}">
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace"/>
</pathconvert>
<echo file="${output.dir}/myrepository-content.txt">[ivy@apache:/]$ find ${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace -type f -print${line.separator}</echo>
<echo file="${output.dir}/myrepository-content.txt" append="true">${myrepository.content}</echo>
<delete dir="${tutorial.build.dir}"/>
<echo>NB! This tutorial fails deliberately!</echo>
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2-deps" output="${output.dir}/install-deps.txt" failonerror="false"/>
<pathconvert property="myrepository.content.deps" pathsep="${line.separator}">
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace/org.hibernate/hibernate"/>
</pathconvert>
<echo file="${output.dir}/myrepository-content-deps.txt">[ivy@apache:/]$ find ${tutorial.src.dir}/build-a-ivy-repository/myrepository/no-namespace/org.hibernate/hibernate -type f -print${line.separator}</echo>
<echo file="${output.dir}/myrepository-content-deps.txt" append="true">${myrepository.content.deps}</echo>
<delete dir="${tutorial.build.dir}"/>
<!--Building a repository - advanced.html -->
<run-tutorial antfile="${tutorial.src.dir}/build-a-ivy-repository/build.xml" target="maven2-namespace" output="${output.dir}/install-namespace.txt"/>
<pathconvert property="myrepository.content.namespace" pathsep="${line.separator}">
<fileset dir="${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced"/>
</pathconvert>
<echo file="${output.dir}/myrepository-content-namespace.txt">$ find ${tutorial.src.dir}/build-a-ivy-repository/myrepository/advanced -type f -print${line.separator}</echo>
<echo file="${output.dir}/myrepository-content-namespace.txt" append="true">${myrepository.content.namespace}</echo>
<delete dir="${tutorial.build.dir}"/>
<!-- multi-project - multiproject.html -->
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="-p" output="${output.dir}/multi-project-general-antp.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/multi-project/projects/find/build.xml" target="-p" output="${output.dir}/multi-project-find-antp.txt"/>
<run-tutorial antfile="${tutorial.src.dir}/multi-project/build.xml" target="publish-all" output="${output.dir}/multi-project-general-publishall.txt"/>
<delete dir="${tutorial.build.dir}"/>
<!-- Correct the location of the examples to a dummy '/ivy' location -->
<pathconvert property="tutorial.root" dirsep="/">
<identitymapper/>
<path location="${tutorial.src.dir}"/>
</pathconvert>
<pathconvert property="tutorial.local" dirsep="/">
<identitymapper/>
<path location="${tutorial.local-repo}"/>
</pathconvert>
<pathconvert property="ivy.jar.location" dirsep="/">
<identitymapper/>
<fileset file="${artifacts.build.dir}/jars/${final.name}"/>
</pathconvert>
<replace dir="${output.dir}" token="\" value="/"/>
<replace dir="${output.dir}" token="${tutorial.root}" value="/ivy"/>
<replace dir="${output.dir}" token="${tutorial.local}" value="/home/ivy/.ivy2/local"/>
<replace dir="${output.dir}" token="${ivy.jar.location}" value="//home/ivy/ivy.jar"/>
<replace dir="${output.dir}" token="-f build.xml " value=""/>
<replace dir="${output.dir}" token="${ivy.revision}" value="working@apache"/>
</target>
<target name="init-asciidoctor-extensions" depends="init-ivy" unless="skip.doc">
<ivy:cachepath pathid="asciidoctorj.path" organisation="org.asciidoctor" module="asciidoctorj" revision="1.5.7" conf="default" inline="true"/>
<mkdir dir="${build.dir}/asciidoc-extensions/classes"/>
<javac srcdir="${doc.src.dir}/templates/extensions/src" destdir="${build.dir}/asciidoc-extensions/classes"
debug="true" includeantruntime="no" classpathref="asciidoctorj.path"/>
<copy todir="${build.dir}/asciidoc-extensions">
<fileset dir="${doc.src.dir}/templates/extensions/src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="init-asciidoctor" depends="init-asciidoctor-extensions" unless="skip.doc">
<mkdir dir="${build.dir}/asciidoc-lib/jars"/>
<mkdir dir="${build.dir}/asciidoc-lib/classes"/>
<ivy:retrieve organisation="org.asciidoctor" module="asciidoctor-ant" revision="1.5.5" conf="default" inline="true" pattern="${build.dir}/asciidoc-lib/jars/[artifact].[ext]"/>
<unzip src="${build.dir}/asciidoc-lib/jars/asciidoctor-ant.jar" dest="${build.dir}/asciidoc-lib/classes"/>
<taskdef uri="antlib:org.asciidoctor.ant" resource="org/asciidoctor/ant/antlib.xml">
<classpath>
<pathelement location="${build.dir}/asciidoc-extensions/classes"/>
<pathelement location="${build.dir}/asciidoc-lib/classes"/>
</classpath>
</taskdef>
</target>
<target name="copy-doc-files" unless="skip.doc">
<copy todir="${doc.build.dir}">
<fileset dir="${doc.src.dir}" includes="images/**,style/**,samples/**,js/**,ivy.xsd"/>
<fileset dir="${doc.src.dir}" includes="tutorial/log/multi-project-general-publishall.txt"/>
</copy>
</target>
<target name="generate-doc" depends="generate-tutorial-output,default-version,init-asciidoctor,copy-doc-files" unless="skip.doc">
<asciidoctor:convert sourceDirectory="${doc.src.dir}" outputDirectory="${doc.build.dir}" backend="xhtml5"
templateDir="${doc.src.dir}/templates" preserveDirectories="true"
sourceHighlighter="highlightjs">
<attribute key="basedir" value="${doc.src.dir}"/>
<attribute key="imagesdir" value=""/>
<attribute key="version" value="${build.version}"/>
<inlineMacroProcessor blockName="jira" className="org.apache.ivy.asciidoc.JiraMacro"/>
</asciidoctor:convert>
</target>
<target name="generate-book-adoc" depends="default-version,copy-doc-files" unless="skip.doc">
<scriptdef name="generate-book-adoc" language="javascript">
<attribute name="jsontocfile"/>
<attribute name="destFile"/>
<![CDATA[
var tocfile = self.getProject().resolveFile(attributes.get("jsontocfile"))
r = new java.io.BufferedReader(new java.io.FileReader(tocfile));
var val = "";
while ((s = r.readLine()) != null) {
val += s;
}
r.close();
var toc = eval("("+val+")")
var writeToc = function(o, children, level) {
for (var c in children) {
o.write(level + ' link:#' + children[c].id.replace(/\//g, '_') + '[' + children[c].title + ']\n');
if (children[c].children && children[c].children.length && children[c].children.length != 0) {
writeToc(o, children[c].children, level+'*');
}
}
};
var writeInclude = function(o, children) {
for (var c in children) {
o.write('== [[' + children[c].id.replace(/\//g, '_') + ']]' + children[c].title + '\n\n');
o.write('include::../asciidoc/' + children[c].id + '.adoc[]\n\n');
if (children[c].children && children[c].children.length && children[c].children.length != 0) {
writeInclude(o, children[c].children);
}
}
};
out = new java.io.FileWriter(self.getProject().resolveFile(attributes.get("destfile")));
out.write('== Table of Contents\n\n');
writeToc(out, toc.children[0].children, '*');
out.write('\n\n');
writeInclude(out, toc.children[0].children, '*');
out.close();
]]>
</scriptdef>
<mkdir dir="${build.dir}/book"/>
<generate-book-adoc jsontocfile="${doc.src.dir}/toc.json" destFile="${build.dir}/book/book.adoc"/>
</target>
<target name="generate-book" depends="generate-book-adoc,init-asciidoctor">
<asciidoctor:convert sourceDirectory="${build.dir}/book" outputDirectory="${doc.build.dir}" backend="xhtml5"
templateDir="${doc.src.dir}/templates/book" sourceHighlighter="highlightjs" doctype="book">
<attribute key="version" value="${build.version}"/>
<inlineMacroProcessor blockName="jira" className="org.apache.ivy.asciidoc.JiraMacro"/>
</asciidoctor:convert>
</target>
<target name="all-doc" depends="javadoc,generate-doc,generate-book"/>
<target name="init-snapshot" depends="default-version">
<property name="snapshot.full.name" value="apache-ivy-${build.version}"/>
</target>
<target name="snapshot-metadata" depends="init-snapshot,resolve">
<mkdir dir="${artifacts.build.dir}"/>
<ivy:deliver
deliverpattern="${artifacts.build.dir}/ivy.xml"
pubrevision="${build.version}"
pubdate="${pubdate}"
status="${status}"/>
</target>
<target name="snapshot-src" depends="init-snapshot">
<delete dir="${build.dir}/snapshot-src" failonerror="false"/>
<exec executable="git" failonerror="true">
<arg line="clone ${basedir} ${build.dir}/snapshot-src"/>
</exec>
<exec dir="${build.dir}/snapshot-src" executable="git" failonerror="true">
<arg line="clean -d -x -f"/>
</exec>
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.zip" defaultexcludes="no">
<zipfileset dir="${build.dir}/snapshot-src" prefix="${snapshot.full.name}" defaultexcludes="no" excludes=".git/**"/>
</zip>
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-src.tar.gz"
compression="gzip" longfile="gnu" defaultexcludes="no">
<zipfileset dir="${build.dir}/snapshot-src" prefix="${snapshot.full.name}" defaultexcludes="no" excludes=".git/**"/>
</tar>
</target>
<target name="snapshot-bin-without-dependencies" depends="snapshot-metadata,jar,all-doc">
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip">
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
<zipfileset dir="${basedir}" includes="build-for-bin-distrib.xml" fullpath="${snapshot.full.name}/build.xml"/>
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
</zip>
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.tar.gz"
compression="gzip" longfile="gnu">
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin.zip"/>
</tar>
</target>
<target name="snapshot-bin-with-dependencies" depends="snapshot-metadata,jar,all-doc">
<mkdir dir="${distrib.dir}/dist/${build.version}"/>
<delete dir="${build.dir}/lib"/>
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]"/>
<zip destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip">
<zipfileset dir="${doc.build.dir}" prefix="${snapshot.full.name}/doc" excludes="**/reports/coverage/**,**/reports/test/**"/>
<zipfileset dir="${basedir}/src/example" prefix="${snapshot.full.name}/src/example"/>
<zipfileset dir="${basedir}" includes="NOTICE" fullpath="${snapshot.full.name}/NOTICE"/>
<zipfileset dir="${basedir}" includes="README" prefix="${snapshot.full.name}"/>
<zipfileset dir="${basedir}" includes="LICENSE*" prefix="${snapshot.full.name}"/>
<zipfileset dir="${basedir}" includes="CHANGES.txt" fullpath="${snapshot.full.name}/CHANGES.txt"/>
<zipfileset dir="${basedir}" includes="RELEASE_NOTES" fullpath="${snapshot.full.name}/RELEASE_NOTES"/>
<zipfileset dir="${src.dir}/org/apache/ivy/plugins/parser/xml" includes="ivy.xsd" fullpath="${snapshot.full.name}/ivy.xsd"/>
<zipfileset dir="${artifacts.build.dir}" includes="ivy.xml" fullpath="${snapshot.full.name}/ivy.xml"/>
<zipfileset dir="${artifacts.build.dir}/jars" includes="${final.name}" fullpath="${snapshot.full.name}/ivy-${build.version}.jar"/>
<zipfileset dir="${build.dir}/lib" prefix="${snapshot.full.name}/lib" excludes="ant-*.jar,bcpg-*.jar,bcprov*.jar"/>
</zip>
<tar destfile="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.tar.gz"
compression="gzip" longfile="gnu">
<zipfileset src="${distrib.dir}/dist/${build.version}/${snapshot.full.name}-bin-with-deps.zip"/>
</tar>
</target>
<target name="snapshot-bin"
depends="snapshot-bin-with-dependencies,snapshot-bin-without-dependencies"/>
<target name="release-xsd" depends="init-snapshot">
<!-- copies current ivy xml schema to doc source, so that it will be available from web site -->
<copy file="${src.dir}/org/apache/ivy/plugins/parser/xml/ivy.xsd" todir="${doc.src.dir}"/>
</target>
<target name="snapshot-maven2" depends="init-snapshot,snapshot-metadata,jar,sources,javadoc">
<property name="m2.distrib.dir" value="${distrib.dir}/maven2/${build.version}"/>
<ivy:makepom ivyfile="${artifacts.build.dir}/ivy.xml"
pomfile="${m2.distrib.dir}/ivy-${build.version}.pom"
templatefile="${basedir}/src/etc/makepom/pom.template">
<mapping conf="core" scope="compile"/>
<mapping conf="test" scope="test"/>
</ivy:makepom>
<copy file="${artifacts.build.dir}/jars/${final.name}"
tofile="${m2.distrib.dir}/ivy-${build.version}.jar"/>
<!-- jar javadocs -->
<jar destfile="${m2.distrib.dir}/ivy-${build.version}-javadoc.jar">
<fileset dir="${javadoc.build.dir}"/>
</jar>
<!-- copy sources jar -->
<copy file="${artifacts.build.dir}/sources/${final.name}"
tofile="${m2.distrib.dir}/ivy-${build.version}-sources.jar"/>
<checksum algorithm="sha1">
<fileset dir="${m2.distrib.dir}">
<include name="*.pom"/>
<include name="*.jar"/>
</fileset>
</checksum>
<checksum algorithm="sha-512" fileext=".sha512">
<fileset dir="${m2.distrib.dir}">
<include name="*.pom"/>
<include name="*.jar"/>
</fileset>
</checksum>
</target>
<target name="snapshot-checksums">
<checksum algorithm="sha1">
<fileset dir="${distrib.dir}/dist/${build.version}">
<include name="*.pom"/>
<include name="*.jar"/>
<include name="*.zip"/>
<include name="*.gz"/>
</fileset>
</checksum>
<checksum algorithm="sha-512" fileext=".sha512">
<fileset dir="${distrib.dir}/dist/${build.version}">
<include name="*.pom"/>
<include name="*.jar"/>
<include name="*.zip"/>
<include name="*.gz"/>
</fileset>
</checksum>
</target>
<target name="snapshot-version">
<property name="version.prefix" value="${target.ivy.version}-dev-"/>
</target>
<target name="release-version">
<property name="build.version" value="${target.ivy.version}"/>
<echo>Setting version to ${build.version}</echo>
<condition property="status" value="release">
<matches pattern="^\d+\.\d+\.\d+$" string="${build.version}"/>
</condition>
<condition property="status" value="milestone">
<matches pattern="^\d+\.\d+\.\d+-(alpha|beta|rc)\d+$" string="${build.version}"/>
</condition>
<property name="status" value="integration"/>
<echo>Setting status to ${status}</echo>
</target>
<target name="sign" depends="init-ivy">
<property file="${user.home}/ivybuild.properties"/>
<input message="please enter your PGP password: " addproperty="pgp.password"/>
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant_2">
<classpath>
<fileset dir="${artifacts.build.dir}/jars" includes="${final.name}"/>
<fileset dir="${build.dir}/lib" excludes="ant-*.jar"/>
</classpath>
</taskdef>
<ivy2:settings id="sign.settingsId" file="ivysettings-release.xml"/>
<ivy2:cachepath organisation="org.apache.commons" settingsRef="sign.settingsId" transitive="false" log="download-only"
module="commons-openpgp" revision="1.0-SNAPSHOT" inline="true" pathid="openpgp.classpath"/>
<ivy2:cachepath organisation="org.bouncycastle" settingsRef="sign.settingsId" log="download-only"
module="bcprov-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcprov.classpath"/>
<ivy2:cachepath organisation="org.bouncycastle" settingsRef="sign.settingsId" transitive="false" log="download-only"
module="bcpg-jdk16" revision="1.45" inline="true" pathid="bouncycastle.bcpg.classpath"/>
<!--
For some reason, if we use the openpgp:signer task here directly, the bouncycastle security
provider cannot be loaded. If we launch it as a forked process everything works fine !?!
-->
<java classname="org.apache.tools.ant.launch.Launcher"
fork="true">
<classpath>
<fileset dir="${ant.home}" includes="**/*.jar"/>
<path refid="bouncycastle.bcprov.classpath"/>
<path refid="bouncycastle.bcpg.classpath"/>
<path refid="openpgp.classpath"/>
</classpath>
<arg line="-f build-release.xml"/>
<arg line="sign-internal"/>
<arg line="-Dpgp.password=${pgp.password}"/>
<arg line="-Dpgp.keyId=${pgp.keyId}"/>
</java>
</target>
<target name="sign-internal">
<property file="build.properties"/>
<taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant"/>
<openpgp:signer secring="${user.home}/.gnupg/secring.gpg"
pubring="${user.home}/.gnupg/pubring.gpg"
password="${pgp.password}"
keyid="${pgp.keyId}"
asciiarmor="true">
<fileset dir="${distrib.dir}">
<include name="**/*.pom"/>
<include name="**/*.jar"/>
<include name="**/*.zip"/>
<include name="**/*.gz"/>
</fileset>
</openpgp:signer>
</target>
<target name="rat" depends="init-ivy">
<property name="rat.failOnError" value="true"/>
<ivy:cachepath organisation="org.apache.rat" module="apache-rat-tasks" revision="0.15"
inline="true" conf="default" pathid="rat.classpath"
log="download-only"/>
<typedef resource="org/apache/rat/anttasks/antlib.xml"
uri="antlib:org.apache.rat.anttasks"
classpathref="rat.classpath"/>
<delete dir="${rat.report.dir}"/>
<mkdir dir="${rat.report.dir}"/>
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report.dir}/rat-report.txt">
<fileset dir="${basedir}">
<exclude name=".classpath"/>
<exclude name="ReleaseInstructions"/>
<exclude name=".ivy2/**/*"/>
<exclude name="build/**/*"/>
<exclude name="bin/**/*"/>
<exclude name="**/*.md5"/>
<exclude name="**/*.sha1"/>
<exclude name="**/*.sha512"/>
<exclude name="**/*.txt"/>
<exclude name="**/MANIFEST*.MF"/>
<exclude name="**/*.json"/>
<exclude name="**/*.SHA-256"/>
<exclude name="**/*.SHA-512"/>
<exclude name="asciidoc/js/jquery.pack.js"/>
<exclude name="asciidoc/js/jquery.treeview.js"/>
</fileset>
</rat:report>
<fail message="Some files have missing or incorrect license information. Check RAT report for more details: ${rat.report.dir}/rat-report.txt">
<condition>
<and>
<not><resourcecontains resource="${rat.report.dir}/rat-report.txt" substring="0 Unknown Licenses" casesensitive="false"/></not>
<equals arg1="${rat.failOnError}" arg2="true"/>
</and>
</condition>
</fail>
</target>
<target name="upload-nexus" depends="release-version,init-ivy,jar">
<ivy:retrieve conf="default" pattern="${build.dir}/lib/[artifact]-[revision].[ext]"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant_2">
<classpath>
<fileset dir="${artifacts.build.dir}/jars" includes="${final.name}"/>
<fileset dir="${build.dir}/lib" excludes="ant-*.jar"/>
</classpath>
</taskdef>
<property file="${user.home}/ivybuild.properties"/>
<input message="please enter your PGP password: " addproperty="pgp.password"/>
<input message="please enter your PGP keyId: " addproperty="pgp.keyId"/>
<input message="please enter your repository.apache.org username: " addproperty="upload.user"/>
<input message="please enter your repository.apache.org password: " addproperty="upload.password"/>
<ivy2:settings id="upload.settingsId" file="ivysettings-release.xml"/>
<ivy2:resolve file="${basedir}/build/artifact/ivy.xml" transitive="false"/>
<ivy2:publish organisation="org.apache.ivy"
module="ivy"
revision="${build.version}"
srcivypattern="${basedir}/build/artifact/ivy.xml"
artifactspattern="${basedir}/build/distrib/maven2/[revision]/[artifact]-[revision](-[classifier]).[ext]"
publishivy="false"
conf="core"
settingsRef="upload.settingsId"
resolver="nexus">
<!-- The standard maven2 artifacts -->
<artifact name="ivy" ext="pom" type="ivy"/>
<artifact name="ivy" ext="jar" type="sources" classifier="sources"/>
<artifact name="ivy" ext="jar" type="javadoc" classifier="javadoc"/>
</ivy2:publish>
</target>
<target name="prepare-snapshot"
depends="/localivy,clean-ivy-home,clean,clean-lib,snapshot-version,install,clean-examples,test-report"/>
<target name="snapshot"
depends="prepare-snapshot,snapshot-src,snapshot-bin,snapshot-maven2,snapshot-checksums"
description="used for nightly and integration builds"/>
<target name="release"
depends="release-version,/localivy,clean-ivy-home,clean,clean-lib,rat,snapshot"
description="make a new release of Ivy"/>
<target name="tagsdoc" depends="generate-doc"
description="generate tagsdoc.properties file which can be used in IvyDE for code completion documentation">
<scriptdef name="generate-tagsdoc" language="javascript">
<element name="fileset" type="fileset"/>
<attribute name="destFile"/>
<![CDATA[
fs = elements.get("fileset").get(0);
srcDir = fs.getDir(project);
// Get the files (array) of that fileset
srcFiles = fs.getDirectoryScanner(project).getIncludedFiles();
// iterate over that array
print('processing ' + srcFiles.length + ' source files...');
var xpath = javax.xml.xpath.XPathFactory.newInstance().newXPath();
out = new java.io.FileWriter(self.getProject().resolveFile(attributes.get("destfile")));
for (i = 0; i < srcFiles.length; i++) {
try {
// get the values via Java API
var file = new java.io.File(srcDir, srcFiles[i]);
print('processing ' + file + '...');
inputSource = new org.xml.sax.InputSource(new java.io.FileInputStream(file));
dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
dbf.setIgnoringComments(false);
dbf.setIgnoringElementContentWhitespace(true);
dbf.setNamespaceAware(false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
builder = dbf.newDocumentBuilder();
document = builder.parse(inputSource);
var expression = "//span[contains(@class, 'ivysettings.')]";
var t = xpath.evaluate(expression, document, javax.xml.xpath.XPathConstants.NODE);
if (t == null) {
print('\tno tagdoc span found: ignored');
continue;
}
var id = t.getAttributes().getNamedItem("class").getTextContent();
out.write('##### ' + id + '\n');
out.write(id + ' = ' + t.getTextContent() + '\n');
text = (id === "ivysettings.resolvers") ? "Name" : "Attribute"
expression = "(//table/thead/tr/th[text()='" + text + "'])[1]/../../../tbody/tr/td[1]";
var atts = xpath.evaluate(expression, document, javax.xml.xpath.XPathConstants.NODESET);
for (j = 0; j < atts.getLength(); j++) {
name = atts.item(j).getTextContent().split(/[\s,]+/).pop()
out.write(id + '.@' + ((id === "ivysettings.resolvers") ? name.toLowerCase() : name) + ' = '
+ xpath.evaluate("../td[2]", atts.item(j), javax.xml.xpath.XPathConstants.NODE)
.getTextContent().replace(/\n/g, " ").replace(/[\x00-\x1F\xA0-\xE1\xE3-\xFF]/g, "") + '\n');
}
} catch (e) {
print('\terror: ' + e);
}
}
out.close();
]]>
</scriptdef>
<generate-tagsdoc destFile="tagsdoc.properties">
<fileset dir="${doc.build.dir}" includes="settings/**/*.html,resolver/**/*.html"/>
</generate-tagsdoc>
</target>
</project>