forked from jesperpedersen/tattletale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
546 lines (481 loc) · 21.9 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
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="jboss-tattletale"
default="dist"
basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="doc.dir" value="${basedir}/doc"/>
<property name="doc.api.dir" value="${doc.dir}/api"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.main.dir" value="${src.dir}/main"/>
<property name="src.java.dir" value="${src.main.dir}/java"/>
<property name="etc.dir" value="${src.dir}/etc"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="reports.dir" value="${basedir}/reports"/>
<property name="tools.dir" value="${basedir}/tools"/>
<property name="name" value="tattletale"/>
<property name="major" value="1"/>
<property name="minor" value="2"/>
<property name="patch" value="0"/>
<property name="type" value="Beta1"/>
<condition property="version" value="${major}.${minor}.${patch}-SNAPSHOT">
<isset property="snapshot"/>
</condition>
<property name="version" value="${major}.${minor}.${patch}.${type}"/>
<property name="tattletale.jar" value="tattletale.jar"/>
<property name="tattletale-sources.jar" value="tattletale-sources.jar"/>
<property name="tattletale-javadoc.jar" value="tattletale-javadoc.jar"/>
<property name="tattletale-ant.jar" value="tattletale-ant.jar"/>
<property name="tattletale-ant-sources.jar" value="tattletale-ant-sources.jar"/>
<property name="tattletale-ant-javadoc.jar" value="tattletale-ant-javadoc.jar"/>
<property name="tattletale-maven.jar" value="tattletale-maven.jar"/>
<property name="tattletale-maven-sources.jar" value="tattletale-maven-sources.jar"/>
<property name="tattletale-maven-javadoc.jar" value="tattletale-maven-javadoc.jar"/>
<property name="tattletale-tools.jar" value="tattletale-tools.jar"/>
<property name="tattletale-tools-sources.jar" value="tattletale-tools-sources.jar"/>
<property name="tattletale-tools-javadoc.jar" value="tattletale-tools-javadoc.jar"/>
<!-- =================================
Repositories
================================= -->
<property name="central.repo" value="http://repo1.maven.org/maven2"/>
<property name="jboss.repo" value="http://repository.jboss.org/nexus/content/groups/public/"/>
<property name="snapshots.repo" value="http://snapshots.jboss.org/maven2"/>
<!-- =================================
Maven repository settings
================================= -->
<property name="mavensettings" value="$HOME/.m2/settings.xml"/>
<condition property="repositoryurl" value="https://repository.jboss.org/nexus/content/repositories/snapshots/">
<isset property="snapshot"/>
</condition>
<property name="repositoryurl" value="https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/"/>
<condition property="repositoryid" value="jboss-snapshots">
<isset property="snapshot"/>
</condition>
<property name="repositoryid" value="jboss-releases"/>
<!-- =================================
Ivy
================================= -->
<property name="ivy.version" value="2.2.0"/>
<property name="ivy.dir" value="${user.home}/.ivy2/cache/org.apache.ivy/jars"/>
<property name="ivy.jar.name" value="ivy-${ivy.version}.jar"/>
<!-- =================================
Versions
================================= -->
<property name="version.ant" value="1.6.5"/>
<property name="version.javassist" value="3.14.0-GA"/>
<property name="version.maven" value="2.0"/>
<!-- =================================================================== -->
<!-- Define the class path -->
<!-- =================================================================== -->
<path id="class.path">
<fileset dir="${lib.dir}/core">
<include name="*.jar"/>
</fileset>
</path>
<path id="test.class.path">
<fileset dir="${lib.dir}/test">
<include name="*.jar"/>
</fileset>
<fileset dir="${dist.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="checkstyle.class.path">
<fileset dir="${tools.dir}/checkstyle/lib"/>
<fileset dir="${lib.dir}/core">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${dist.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- =================================
Bootstrap Ivy
================================= -->
<mkdir dir="${ivy.dir}"/>
<get usetimestamp="true" src="https://repository.apache.org/content/repositories/releases/org/apache/ivy/ivy/${ivy.version}/${ivy.jar.name}"
skipexisting="true"
dest="${ivy.dir}/${ivy.jar.name}"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.dir}/${ivy.jar.name}"/>
<!-- =================================================================== -->
<!-- Initialize -->
<!-- =================================================================== -->
<target name="init">
<ivy:settings file="${basedir}/ivy.settings.xml"/>
</target>
<!-- =================================
Target: resolve
================================= -->
<target name="resolve" depends="init">
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]"
conf="core"
sync="true"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the directory structure -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Jars -->
<!-- =================================================================== -->
<target name="jars" depends="prepare,resolve">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/META-INF"/>
<mkdir dir="${build.dir}/META-INF/maven"/>
<copy file="src/main/java/org/jboss/tattletale/Version.java.in"
tofile="${build.dir}/org/jboss/tattletale/Version.java">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy file="src/main/java/org/jboss/tattletale/package.html"
todir="${build.dir}/org/jboss/tattletale/"/>
<javac
destdir="${build.dir}"
classpathref="class.path"
debug="on"
deprecation="on"
optimize="off"
source="1.5"
target="1.5"
>
<src path="${build.dir}"/>
</javac>
<javac
destdir="${build.dir}"
classpathref="class.path"
debug="on"
deprecation="on"
optimize="off"
source="1.5"
target="1.5"
>
<src path="${src.java.dir}"/>
</javac>
<copy todir="${build.dir}">
<fileset dir="${etc.dir}">
<include name="**/jboss-tattletale.properties"/>
</fileset>
<fileset dir="${etc.dir}">
<include name="**/*.clz"/>
<include name="**/*.clz.gz"/>
</fileset>
<fileset dir="${etc.dir}">
<include name="**/*.css"/>
</fileset>
</copy>
<copy todir="${build.dir}/org/jboss/tattletale/ant">
<fileset dir="${etc.dir}">
<include name="antlib.xml"/>
</fileset>
</copy>
<copy todir="${build.dir}/META-INF/maven">
<fileset dir="${etc.dir}">
<include name="plugin.xml"/>
</fileset>
<filterset>
<filter token="VERSION.TATTLETALE" value="${version}"/>
</filterset>
</copy>
<jar destfile="${dist.dir}/${tattletale.jar}"
basedir="${build.dir}"
manifest="${etc.dir}/core-manifest.mf"
includes="org/jboss/tattletale/**,**/*.properties,**/*.clz,**/*.clz.gz,**/*.css"
excludes="**/ant/**,**/maven/**,**/tools/**,**/*.java"/>
<jar destfile="${dist.dir}/${tattletale-ant.jar}"
basedir="${build.dir}"
manifest="${etc.dir}/ant-manifest.mf"
includes="org/jboss/tattletale/ant/**"
excludes="**/*.java"/>
<jar destfile="${dist.dir}/${tattletale-maven.jar}"
basedir="${build.dir}"
manifest="${etc.dir}/maven-manifest.mf"
includes="org/jboss/tattletale/maven/**,META-INF/**"
excludes="**/*.java">
</jar>
<jar destfile="${dist.dir}/${tattletale-tools.jar}"
basedir="${build.dir}"
manifest="${etc.dir}/tools-manifest.mf"
includes="org/jboss/tattletale/tools/**,META-INF/**"
excludes="**/*.java">
</jar>
</target>
<!-- =================================================================== -->
<!-- Artifacts -->
<!-- =================================================================== -->
<target name="artifacts" depends="jars">
<!-- Sources -->
<jar destfile="${dist.dir}/${tattletale-sources.jar}"
basedir="${src.java.dir}"
includes="**/*.java"
excludes="**/ant/**,**/maven/**"/>
<jar destfile="${dist.dir}/${tattletale-ant-sources.jar}"
basedir="${src.java.dir}"
includes="**/ant/*.java"/>
<jar destfile="${dist.dir}/${tattletale-maven-sources.jar}"
basedir="${src.java.dir}"
includes="**/maven/*.java"/>
<mkdir dir="${build.dir}/artifact-javadoc"/>
<javadoc destdir="${build.dir}/artifact-javadoc"
author="true"
version="true"
windowtitle="JBoss Tattletale"
doctitle="JBoss Tattletale"
use="true"
classpathref="class.path"
bottom="Copyright © 2011 JBoss (http://www.jboss.com/)">
<packageset dir="${build.dir}" defaultexcludes="yes"/>
<packageset dir="src/main/java" defaultexcludes="yes">
<exclude name="**/ant/**"/>
<exclude name="**/maven/**"/>
</packageset>
<link offline="true" href="http://java.sun.com/j2se/1.5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
</javadoc>
<jar destfile="${dist.dir}/${tattletale-javadoc.jar}"
basedir="${build.dir}/artifact-javadoc"/>
<delete dir="${build.dir}/artifact-javadoc"/>
<mkdir dir="${build.dir}/artifact-javadoc"/>
<javadoc destdir="${build.dir}/artifact-javadoc"
author="true"
version="true"
windowtitle="JBoss Tattletale"
doctitle="JBoss Tattletale"
use="true"
classpathref="class.path"
bottom="Copyright © 2011 JBoss (http://www.jboss.com/)">
<packageset dir="${build.dir}" defaultexcludes="yes"/>
<packageset dir="src/main/java" defaultexcludes="yes">
<include name="**/ant/**"/>
</packageset>
<link offline="true" href="http://java.sun.com/j2se/1.5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
</javadoc>
<jar destfile="${dist.dir}/${tattletale-ant-javadoc.jar}"
basedir="${build.dir}/artifact-javadoc"
includes="**/ant/**"/>
<delete dir="${build.dir}/artifact-javadoc"/>
<mkdir dir="${build.dir}/artifact-javadoc"/>
<javadoc destdir="${build.dir}/artifact-javadoc"
author="true"
version="true"
windowtitle="JBoss Tattletale"
doctitle="JBoss Tattletale"
use="true"
classpathref="class.path"
bottom="Copyright © 2011 JBoss (http://www.jboss.com/)">
<packageset dir="${build.dir}" defaultexcludes="yes"/>
<packageset dir="src/main/java" defaultexcludes="yes">
<include name="**/maven/**"/>
</packageset>
<link offline="true" href="http://java.sun.com/j2se/1.5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
</javadoc>
<jar destfile="${dist.dir}/${tattletale-maven-javadoc.jar}"
basedir="${build.dir}/artifact-javadoc"
includes="**/maven/**"/>
<delete dir="${build.dir}/artifact-javadoc"/>
</target>
<!-- =================================================================== -->
<!-- Doc -->
<!-- =================================================================== -->
<target name="doc">
<mkdir dir="${doc.api.dir}"/>
<javadoc packagenames="org.*"
sourcepath="${src.java.dir}"
destdir="${doc.api.dir}"
author="true"
version="true"
windowtitle="JBoss Tattletale"
doctitle="JBoss Tattletale"
use="true"
classpathref="class.path"
bottom="Copyright © 2011 JBoss (http://www.jboss.com/)">
<link offline="true" href="http://java.sun.com/j2se/1.5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
</javadoc>
<ant dir="doc/userguide" target="pdf"/>
<ant dir="doc/developerguide" target="pdf"/>
</target>
<!-- =================================================================== -->
<!-- Dist -->
<!-- =================================================================== -->
<target name="dist" depends="jars">
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}/core">
<include name="**/*.jar"/>
<exclude name="**/ant.jar"/>
<exclude name="**/maven-plugin-api.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${etc.dir}">
<include name="**/log4j.xml"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${etc.dir}">
<include name="**/*.properties"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${doc.dir}">
<include name="*.txt"/>
<include name="*.html"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Release -->
<!-- =================================================================== -->
<target name="release" depends="clean,dist">
<delete dir="${build.dir}"/>
<ant dir="doc/userguide" target="pdf"/>
<ant dir="doc/developerguide" target="pdf"/>
<mkdir dir="${build.dir}/${name}-${major}.${minor}.${patch}.${type}"/>
<move flatten="true" todir="${build.dir}/${name}-${major}.${minor}.${patch}.${type}">
<fileset dir="${dist.dir}">
<include name="**/*.pdf"/>
</fileset>
</move>
<delete dir="${build.dir}/docbook"/>
<delete dir="${build.dir}/en"/>
<move todir="${build.dir}/${name}-${major}.${minor}.${patch}.${type}"
includeEmptyDirs="false">
<fileset dir="${dist.dir}">
<include name="**/*"/>
<exclude name="**/${tattletale-tools.jar}"/>
</fileset>
</move>
<zip destfile="${name}-${major}.${minor}.${patch}.${type}.zip"
basedir="${build.dir}"/>
<tar destfile="${name}-${major}.${minor}.${patch}.${type}.tar"
basedir="${build.dir}"/>
<gzip zipfile="${name}-${major}.${minor}.${patch}.${type}.tar.gz"
src="${name}-${major}.${minor}.${patch}.${type}.tar"/>
<delete file="${name}-${major}.${minor}.${patch}.${type}.tar"/>
</target>
<!-- =================================
Target: checkstyle
================================= -->
<target name="checkstyle" depends="jars">
<taskdef name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
classpathref="checkstyle.class.path"/>
<mkdir dir="${reports.dir}/checkstyle" />
<checkstyle config="${tools.dir}/checkstyle/checkstyle.xml"
failOnViolation="false"
classpathref="checkstyle.class.path">
<fileset dir="${basedir}"
includes="**/*.java"/>
<formatter type="plain"/>
<formatter type="xml" toFile="${reports.dir}/checkstyle/checkstyle-result.xml"/>
</checkstyle>
</target>
<!-- =================================================================== -->
<!-- Clean -->
<!-- =================================================================== -->
<target name="clean">
<delete>
<fileset dir="${basedir}" defaultexcludes="no">
<include name="**/*~" />
<include name="**/*.bak"/>
</fileset>
</delete>
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${doc.api.dir}"/>
<delete dir="${reports.dir}"/>
<delete file="${name}-${major}.${minor}.${patch}.${type}.zip"/>
<delete file="${name}-${major}.${minor}.${patch}.${type}.tar.gz"/>
</target>
<!-- =================================
Target: clean-cache
================================= -->
<target name="clean-cache">
<ivy:cleancache />
</target>
<!-- =================================
Target: nexus
================================= -->
<macrodef name="deploy-file">
<attribute name="file"/>
<attribute name="artifact"/>
<attribute name="extension"/>
<sequential>
<concat destfile="${dist.dir}/@{file}" append="true" force="true" eol="unix">
mvn -s ${mavensettings} org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file -Dfile=$PWD/@{artifact}.@{extension} -DpomFile=@{artifact}.xml -Dsources=$PWD/@{artifact}-sources.jar -Djavadoc=$PWD/@{artifact}-javadoc.jar $REPOSITORY
</concat>
</sequential>
</macrodef>
<macrodef name="install-file">
<attribute name="file"/>
<attribute name="artifact"/>
<attribute name="extension"/>
<sequential>
<concat destfile="${dist.dir}/@{file}" append="true" force="true" eol="unix">
mvn install:install-file -Dfile=$PWD/@{artifact}.@{extension} -DpomFile=@{artifact}.xml -Dsources=$PWD/@{artifact}-sources.jar -Djavadoc=$PWD/@{artifact}-javadoc.jar
</concat>
</sequential>
</macrodef>
<target name="nexus" depends="clean,artifacts">
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]"
conf="${name},${name}-ant,${name}-maven"
sync="true"/>
<delete file="${dist.dir}/deploy.sh"/>
<delete file="${dist.dir}/install.sh"/>
<concat destfile="${dist.dir}/deploy.sh" append="true" force="true" eol="unix">#!/bin/sh
PWD=`pwd`
VERSION=${version}
REPOSITORY='-Durl=${repositoryurl} -DrepositoryId=${repositoryid}'
</concat>
<concat destfile="${dist.dir}/install.sh" append="true" force="true" eol="unix">#!/bin/sh
PWD=`pwd`
VERSION=${version}
</concat>
<!-- tattletale -->
<delete file="${dist.dir}/${name}.xml"/>
<ivy:makepom artifactName="${name}"
conf="${name}"
ivyfile="${basedir}/ivy.xml"
pomfile="${dist.dir}/${name}.xml"
headerFile="${basedir}/maven/HEADER"
templatefile="${basedir}/maven/pom.template"
printIvyInfo="false">
<mapping conf="${name}" scope="runtime"/>
</ivy:makepom>
<deploy-file file="deploy.sh" artifact="${name}" extension="jar"/>
<install-file file="install.sh" artifact="${name}" extension="jar"/>
<!-- tattletale-ant -->
<delete file="${dist.dir}/${name}-ant.xml"/>
<ivy:makepom artifactName="${name}-ant"
conf="${name}-ant"
ivyfile="${basedir}/ivy.xml"
pomfile="${dist.dir}/${name}-ant.xml"
headerFile="${basedir}/maven/HEADER"
templatefile="${basedir}/maven/pom.template"
printIvyInfo="false">
<mapping conf="${name}-ant" scope="runtime"/>
<dependency artifact="${name}" scope="runtime"/>
</ivy:makepom>
<deploy-file file="deploy.sh" artifact="${name}-ant" extension="jar"/>
<install-file file="install.sh" artifact="${name}-ant" extension="jar"/>
<!-- tattletale-maven -->
<delete file="${dist.dir}/${name}-maven.xml"/>
<ivy:makepom artifactName="${name}-maven"
conf="${name}-maven"
ivyfile="${basedir}/ivy.xml"
pomfile="${dist.dir}/${name}-maven.xml"
headerFile="${basedir}/maven/HEADER"
templatefile="${basedir}/maven/pom.template"
printIvyInfo="false">
<mapping conf="${name}-maven" scope="runtime"/>
<dependency artifact="${name}" scope="runtime"/>
</ivy:makepom>
<deploy-file file="deploy.sh" artifact="${name}-maven" extension="jar"/>
<install-file file="install.sh" artifact="${name}-maven" extension="jar"/>
<chmod file="${dist.dir}/deploy.sh" perm="755"/>
<chmod file="${dist.dir}/install.sh" perm="755"/>
</target>
</project>