forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
467 lines (402 loc) · 17.1 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
<project name="testng" default="dev" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- ====================================================================== -->
<!-- TestNG build file -->
<!-- Created cbeust, April 26th, 2004 -->
<!-- ====================================================================== -->
<property file="build.properties" />
<property name="optimize" value="false" />
<!-- ====================================================================== -->
<!-- PREPARE -->
<!-- ====================================================================== -->
<target name="prepare" depends="retrieve-dependencies"
description="Performs all preparations required to build.">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${other.jars.dir}" />
</target>
<!-- ====================================================================== -->
<!-- DUMP -->
<!-- ====================================================================== -->
<target name="dump" description="Dumps all properties." depends="prepare">
<echoproperties />
</target>
<!-- ====================================================================== -->
<!-- VALIDATE -->
<!-- ====================================================================== -->
<target name="validate" description="Validates the build environment.">
<!-- java greater than 1.6 required to build -->
<condition property="requiredJavaVersion">
<or>
<equals arg1="${ant.java.version}" arg2="1.9" />
<equals arg1="${ant.java.version}" arg2="1.8" />
<equals arg1="${ant.java.version}" arg2="1.7" />
</or>
</condition>
<fail unless="requiredJavaVersion"
message="Java version 1.7 required." />
<!-- validate ant version too ... -->
</target>
<!-- ==================================================================== -->
<!-- COPY-RESOURCES -->
<!-- ==================================================================== -->
<target name="copy-resources" description="Copies resources.">
<copy verbose="false"
file="${src.resources.dir}/testngtasks"
todir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${src.resources.dir}">
<exclude name="**/.*" />
<exclude name="**/CVS/*" />
</fileset>
</copy>
</target>
<target name="dev"
depends="prepare,validate,copy-resources,build,tests" />
<target name="all"
depends="prepare,validate,copy-resources,build,dist,tests,test-ant,javadocs,dist" />
<target name="build" depends="prepare,compile,testng-jar-all" />
<target name="testng-jar-all">
<antcall target="create-jar">
<param name="jar.file" value="${testng.jar}" />
</antcall>
<jar jarfile="${testng.jar}" update="true">
<zipfileset src="${lib.dir}/${beanshell.jar}" />
<zipfileset src="${lib.dir}/${jcommander.jar}" />
<zipfileset src="${lib.dir}/${yaml.jar}" />
</jar>
</target>
<target name="single">
<ant antfile="build-tests.xml" target="run:single"/>
</target>
<!-- ==================================================================== -->
<!-- Compile -->
<!-- ==================================================================== -->
<path id="compile2.cp">
<fileset dir="${lib.dir}" includes="${all.jar.files}" />
</path>
<target name="compile"
depends="prepare,copy-resources"
description="Compiles sources">
<echo message=" -- Compiling sources --" />
<echo>Src:${src.dir}</echo>
<javac classpathref="compile2.cp"
verbose="false"
target="1.7"
debug="true"
optimize="${optimize}"
destdir="${build.dir}">
<src path="${src.dir}" />
</javac>
</target>
<target name="compile:all" depends="compile" />
<target name="examples">
<ant inheritall="no" antfile="examples/build.xml" />
</target>
<target name="tests" depends="build" description="runs all JDK5 tests with JDK5 distro">
<ant inheritall="no" antfile="build-tests.xml" />
</target>
<target name="test-ant" depends="build">
<echo message=" -- Testing ant testng task functionality --" />
<ant inheritall="no" antfile="build-ant.xml" />
</target>
<!-- ==================================================================== -->
<!-- Documentation -->
<!-- ==================================================================== -->
<target name="javadocs" depends="build,javadocs-current" />
<target name="doclava">
<javadoc
docletpath="3rdparty/doclava-1.0.3.jar"
bootclasspath="${javahome}/jre/lib/rt.jar"
classpath="${testng.jar}:lib/${ant.jar}:lib/${guice2.jar}:lib/aopalliance-1.0.jar"
maxmemory="2048M"
additionalparam="-quiet"
verbose="false"
destdir="javadocs"
>
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/*.java" />
</fileset>
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/xml/Xml*.java" />
</fileset>
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/annotations/**" />
</fileset>
<doclet name="com.google.doclava.Doclava">
<param name="-stubs" value="build/stubs" />
<param name="-hdf"/>
<param name="project.name" value="TestNG" />
<!-- versioning -->
<param name="-since"/>
<param name="doclava/previous.xml"/>
<param name="v1" />
<param name="-apiversion" value="v2"/>
<!-- federation -->
<param name="-federate" />
<param name="JDK"/>
<param name="http://download.oracle.com/javase/6/docs/api/index.html?"/>
<param name="-federationxml"/><param name="JDK"/>
<param name="http://doclava.googlecode.com/svn/static/api/openjdk-6.xml"/>
</doclet>
</javadoc>
</target>
<target name="javadocs-current">
<javadoc additionalparam="-quiet" destdir="javadocs" source="1.7" windowtitle="TestNG"
classpath="${testng.jar}" classpathref="compile2.cp" verbose="false">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/*.java" />
</fileset>
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/xml/Xml*.java" />
</fileset>
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="org/testng/annotations/**" />
</fileset>
</javadoc>
</target>
<!-- ==================================================================== -->
<!-- Distribution -->
<!-- ==================================================================== -->
<target name="dist" depends="build,all-jar-flavors,dist-all-zip,eclipse" />
<target name="all-jar-flavors" depends="dist-junit,dist-nobsh-guice,dist-bsh-noguice,dist-nobsh-noguice,dist-testng-dist,dist-testng-javadoc" />
<target name="dist-junit">
<antcall target="create-jar">
<param name="jar.file" value="${other.jars.dir}/${testng.junit.jar}" />
</antcall>
<jar jarfile="${other.jars.dir}/${testng.junit.jar}" update="true">
<zipfileset src="${lib.dir}/${beanshell.jar}" />
<zipfileset src="${lib.dir}/${jcommander.jar}" />
<zipfileset src="${lib.dir}/${junit.jar}" />
<zipfileset src="${lib.dir}/${yaml.jar}" />
</jar>
</target>
<target name="dist-nobsh-guice">
<antcall target="create-jar">
<param name="jar.file" value="${other.jars.dir}/${testng.nobsh.guice.jar}" />
</antcall>
<jar jarfile="${other.jars.dir}/${testng.nobsh.guice.jar}" update="true">
<zipfileset src="${lib.dir}/${guice2.jar}" />
<zipfileset src="${lib.dir}/${jcommander.jar}" />
<zipfileset src="${lib.dir}/${junit.jar}" />
</jar>
</target>
<target name="dist-bsh-noguice">
<antcall target="create-jar">
<param name="jar.file" value="${other.jars.dir}/${testng.bsh.noguice.jar}" />
</antcall>
<jar jarfile="${other.jars.dir}/${testng.bsh.noguice.jar}" update="true">
<zipfileset src="${lib.dir}/${beanshell.jar}" />
<zipfileset src="${lib.dir}/${jcommander.jar}" />
<zipfileset src="${lib.dir}/${junit.jar}" />
</jar>
</target>
<target name="dist-nobsh-noguice">
<antcall target="create-jar">
<param name="jar.file" value="${other.jars.dir}/${testng.nobsh.noguice.jar}" />
</antcall>
<jar jarfile="${other.jars.dir}/${testng.bsh.noguice.jar}" update="true">
<zipfileset src="${lib.dir}/${jcommander.jar}" />
<zipfileset src="${lib.dir}/${junit.jar}" />
</jar>
</target>
<target name="dist-testng-dist">
<antcall target="create-jar">
<param name="jar.file" value="${other.jars.dir}/${testng.dist.jar}" />
</antcall>
<jar jarfile="${other.jars.dir}/${testng.dist.jar}" update="true">
<zipfileset src="${lib.dir}/${jcommander.jar}" />
</jar>
</target>
<target name="dist-testng-javadoc" depends="javadocs">
<zip destfile="${other.jars.dir}/${testng.javadoc.zip}">
<fileset dir="javadocs"/>
</zip>
</target>
<target name="create-jar" description="Create a jar file with the Testng classes and nothing else"
depends="compile">
<delete file="${jar.file}" />
<jar destfile="${jar.file}" >
<manifest>
<attribute name="Main-Class" value="org.testng.TestNG" />
<attribute name="Implementation-Version" value="${testng.version}-${DSTAMP}${TSTAMP}" />
</manifest>
<fileset dir="${build.dir}" />
<fileset file="TESTNG-${testng.version}" />
</jar>
</target>
<target name="dist-all-zip" depends="dist-prepare,javadocs">
<property name="zip.dir" value="testng-${testng.version}" />
<echo>Adding ${testng.fullname}</echo>
<zip zipfile="${testng.zip}">
<zipfileset prefix="${zip.dir}" dir="${target}">
<include name="${testng.fullname}.jar" />
</zipfileset>
<zipfileset prefix="${zip.dir}" dir="${basedir}" includesfile="FILES" />
<zipfileset dir="${other.jars.dir}" prefix="${zip.dir}/other-jars"/>
<zipfileset dir="javadocs" prefix="${zip.dir}/javadocs" />
<zipfileset dir="src" prefix="${zip.dir}/src" />
<zipfileset dir="spring" prefix="${zip.dir}/spring" />
<zipfileset dir="doc" prefix="${zip.dir}/doc" />
<zipfileset dir="${src.resources.dir}"
prefix="${zip.dir}/resources"
includes="**/*.css"/>
</zip>
</target>
<!--
<target name="dist-maven-bundle" depends="dist-all-zip">
<mkdir dir="${build.maven-bundle.dir}" />
<copy file="bundle-pom.xml" tofile="${build.maven-bundle.dir}/pom.xml" overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<jar destfile="${build.maven-bundle.dir}/${sources.testng.jar}">
<fileset dir="${src.dir}" />
</jar>
<exec executable="gpg">
<arg value="- -yes" />
<arg value="-ab" />
<arg value="${testng.jar}" />
</exec>
<exec executable="gpg">
<arg value="- -yes" />
<arg value="-ab" />
<arg value="${build.maven-bundle.dir}/pom.xml" />
</exec>
<exec executable="gpg">
<arg value="- -yes" />
<arg value="-ab" />
<arg value="${build.maven-bundle.dir}/${sources.testng.jar}" />
</exec>
<jar destfile="${testng.maven-bundle}">
<fileset file="${build.maven-bundle.dir}/pom.xml" />
<fileset file="${build.maven-bundle.dir}/${sources.testng.jar}" />
<fileset file="${build.maven-bundle.dir}/*asc" />
<fileset file="${testng.jar}" />
<fileset file="${testng.jar}.asc" />
</jar>
</target>
-->
<target name="dist-prepare" depends="update-readme">
<delete file="{other.jars.dir}/${testng.nobsh.jar}" />
<mkdir dir="${other.jars.dir}" />
</target>
<target name="update-readme">
<copy file="README.template" tofile="README.md" />
<replace file="README.md" token="${version}" value="${testng.version}" />
<touch file="TESTNG-${testng.version}" />
</target>
<target name="eclipse" description="Used by Cedric to build distributions">
<property name="jdk15.jar"
value="${testng-eclipse.dir}/lib/testng.jar" />
<delete file="${jdk15.jar}" />
<copy file="${testng.jar}" tofile="${jdk15.jar}" />
<!-- sources -->
<property name="sources" value="${testng-eclipse.dir}/lib/testng-sources.jar"/>
<echo>Sources: ${sources}</echo>
<jar destfile="${sources}" basedir="src/main/java/" />
</target>
<target name="ftp">
<!--
<ftp action="put"
server="beust.com"
remotedir="w/testng/test-output"
userid="${userid}"
password="${password}">
<fileset dir="c:\weblogic\dev\sandbox\cbeust\testng\test\test-output">
<include name="index.html" />
<include name="main.html" />
<include name="toc.html" />
<include name="*egression*" />
</fileset>
</ftp>
-->
<ftp action="put"
server="beust.com"
remotedir="w/testng"
userid="${userid}"
password="${password}">
<fileset dir="${root.dir}">
<include name="${testng.zip}" />
<include name="javadocs/**" />
<include name="testng-1.0.dtd" />
</fileset>
<fileset dir="${root.dir}/doc">
<include name="*.html" />
</fileset>
</ftp>
</target>
<target name="ftp2">
<ftp action="put"
server="beust.com"
remotedir="w/testng"
userid="${userid}"
password="${password}">
<fileset dir="${root.dir}/test">
<include name="test-output/*" />
</fileset>
<fileset dir="${root.dir}/test">
<include name="test-report/*" />
</fileset>
</ftp>
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${target}" />
<delete dir="${build.maven-bundle.dir}" />
<delete failonerror="false">
<fileset dir="." includes="testng*.jar,*.zip" />
</delete>
<delete dir="test-output" failonerror="false" />
<delete dir="test-output-tests" failonerror="false" />
<ant antfile="build-tests.xml" target="clean" />
<ant dir="examples" target="clean" />
</target>
<!-- ==================================================================== -->
<!-- Maven1/2 Distribution -->
<!-- ==================================================================== -->
<!--
<target name="maven-plugin">
<jar destfile="maven-testng-plugin-${testng-maven.version}.jar"
basedir="./maven/" />
</target>
-->
<!-- ==================================================================== -->
<!-- Ivy -->
<!-- ==================================================================== -->
<target name="retrieve-dependencies" description="Retrieve dependencies with ivy">
<ivy:retrieve log="quiet" />
</target>
<target name="publish">
<ivy:resolve />
<mkdir dir="dist/jars" />
<copy file="${testng.jar}" todir="dist/jars" />
<ivy:publish organisation="org.testng" resolver="local" overwrite="true"/>
</target>
<target name="pom">
<ivy:makepom ivyfile="ivy.xml" pomfile="ivy-pom.xml" />
</target>
<!-- ==================================================================== -->
<!-- Code coverage -->
<!-- ==================================================================== -->
<!--
<property name="cobertura.dir" value="../cobertura-1.9.4.1" />
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<target name="coverage:create">
<cobertura-instrument classpath="cobertura-1.9.4.1/lib/*" todir="target/instrumented-classes">
<fileset dir="${build.dir}">
<include name="**/*.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="coverage">
<cobertura-report srcdir="${src.dir}" destdir="target/coverage-report"/>
</target>
-->
</project>