forked from eclipse-ee4j/cditck-porting
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.xml
532 lines (467 loc) · 21.6 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
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019,2020 Payara Foundation and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project name="CDI TCK Glassfish Porting" default="dist" basedir=".">
<property environment="env" />
<property file="${basedir}/build.properties" />
<property name="maven.executable" value="${env.M2_HOME}/bin/mvn" />
<property name="pathsep" value="${path.separator}"/>
<property name="tck.version" value="2.0.0"/>
<property name="src" value="${basedir}/src" />
<property name="classes" value="${basedir}/classes" />
<property name="dist" value="${basedir}/dist" />
<property name="lib" value="${basedir}/lib" />
<property name="dist.file" value="cdi-tck-payara-porting" />
<property name="admin.port" value="4848"/>
<property name="admin.host" value="localhost"/>
<property name="javadb.home" value="${glassfish.home}/../javadb"/>
<property name="javadb.host" value="localhost"/>
<property name="javadb.port" value="1527"/>
<!-- number of seconds to wait for the v4 admin port to be available -->
<property name="wait.for.v4" value="90"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib}/ant-contrib.jar" />
<!-- Set the sig file to use based on the Java SE Version in use -->
<if>
<equals arg1="${java.specification.version}" arg2="1.7"/>
<then>
<property name="sig.file" value="${porting.home}/cdi-tck-impl-sigtest-jdk7.sig" />
</then>
<else>
<property name="sig.file" value="${porting.home}/cdi-tck-impl-sigtest-jdk8.sig" />
</else>
</if>
<condition property="java.classes.for.sig.ext" value="bundle/Classes/classes.jar"
else="lib/rt.jar">
<and>
<os family="mac"/>
<or>
<contains string="${java.version}" substring="1.6" casesensitive="false" />
<contains string="${java.version}" substring="1.5" casesensitive="false" />
<contains string="${java.version}" substring="1.4" casesensitive="false" />
</or>
</and>
</condition>
<condition property="max.classes.restart" value="10"
else="40">
<or>
<os family="windows"/>
<os family="dos"/>
</or>
</condition>
<condition property="excluded.groups" value="<excludedGroups>javaee-full,se</excludedGroups>"
else="<excludedGroups>se</excludedGroups>">
<equals arg1="${javaee.level}" arg2="web" trim="true"/>
</condition>
<condition property="aix.jars" value="${pathsep}${java.home}/lib/annotation.jar${pathsep}${java.home}/lib/vm.jar"
else="">
<and>
<available file="${java.home}/lib/annotation.jar"/>
<available file="${java.home}/lib/vm.jar"/>
</and>
</condition>
<!--Get Glassfish install dir base (minus the glassfish dir) -->
<propertyregex property="glassfish.home.base"
input="${glassfish.home}"
regexp="(.*)[\/|\\]glassfish"
select="\1"
defaultValue="${glassfish.home}"/>
<target name="run.all.tests" depends="sigtest, test"/>
<target name="test" depends="config.v4, copy.settingsxml, filter.arquillian.xml">
<antcall target="start.javadb" />
<delete file="${porting.home}/glassfish-tck-runner/pom.xml"/>
<copy file="${porting.home}/glassfish-tck-runner/pom.template.xml"
tofile="${porting.home}/glassfish-tck-runner/pom.xml">
<filterset>
<filter token="excludedGroups" value="${excluded.groups}"/>
</filterset>
</copy>
<if>
<or>
<os family="windows"/>
<os family="dos"/>
</or>
<then>
<mvn.test.win dir="glassfish-tck-runner"/>
</then>
<else>
<mvn.test dir="glassfish-tck-runner"/>
</else>
</if>
<antcall target="stop.javadb" />
</target>
<target name="sigtest">
<echo message="Java Specification Version in use: ${java.specification.version}"/>
<echo message="Java Home: ${java.home}"/>
<java outputproperty="sigoutput" fork="true" jar="${lib}/sigtest.jar">
<arg value="Signaturetest"/>
<arg value="-Classpath"/>
<arg value="${java.home}/${java.classes.for.sig.ext}${pathsep}${glassfish.home}/modules/weld-osgi-bundle.jar${pathsep}${glassfish.home}/modules/jakarta.enterprise.cdi-api.jar${pathsep}${glassfish.home}/modules/jakarta.inject.jar${pathsep}${glassfish.home}/modules/jakarta.el.jar/${pathsep}${glassfish.home}/modules/jakarta.interceptor-api.jar${aix.jars}"/>
<arg value="-Package"/>
<arg value="javax.enterprise"/>
<arg value="-Package"/>
<arg value="javax.decorator"/>
<arg value="-FileName"/>
<arg value="${sig.file}"/>
<arg value="-Static"/>
</java>
<mkdir dir="${report.dir}"/>
<echo message="${sigoutput}"/>
<echo message="${sigoutput}" file="${report.dir}/cdi_sig_test_results.txt"/>
<echo message="Output is also saved to ${report.dir}/cdi_sig_test_results.txt"/>
</target>
<target name="copy.settingsxml">
<!--
<copy file="${porting.home}/settings.xml" todir="${user.home}/.m2"
flatten="true" overwrite="true">
</copy>
-->
</target>
<target name="copy.tck.ext.lib.jar">
<echo message="Copying cdi-ext-lib jar"/>
<copy file="${user.home}/.m2/repository/org/jboss/cdi/tck/cdi-tck-ext-lib/${cdiext.version}/${cdiextjar}" todir="${porting.home}/lib">
<!--globmapper from="cdi-tck-ext-lib-2.0.0.Alpha7.jar" to="cdi-tck-ext-lib.jar"/-->
</copy>
<copy file="${porting.home}/lib/${cdiextjar}" todir="${glassfish.home}/domains/domain1/lib/applibs"
flatten="true" overwrite="true">
</copy>
</target>
<target name="filter.arquillian.xml">
<delete file="${porting.home}/glassfish-tck-runner/src/test/glassfish-managed/arquillian.xml"/>
<copy file="${porting.home}/glassfish-tck-runner/src/test/glassfish-managed/arquillian.template.xml"
tofile="${porting.home}/glassfish-tck-runner/src/test/glassfish-managed/arquillian.xml">
<filterset>
<filter token="maxClassesRestart" value="${max.classes.restart}"/>
<filter token="glassFishHome" value="${glassfish.home.base}"/>
<filter token="adminHost" value="${admin.host}"/>
<filter token="adminPort" value="${admin.port}"/>
<filter token="adminUser" value="${admin.user}"/>
<filter token="adminPassword" value="${admin.password}"/>
</filterset>
</copy>
</target>
<target name="dist">
<delete file="${dist}/${dist.file}-${tck.version}_${time.stamp.bundle.string}.zip"/>
<delete file="${porting.home}/glassfish-tck-runner/pom.xml"/>
<delete file="${porting.home}/glassfish-tck-runner/src/test/glassfish-managed/arquillian.xml"/>
<if>
<available file="${basedir}/build.properties.sani" />
<then>
<property name="prop.file" value="build.properties.sani" />
</then>
<else>
<property name="prop.file" value="build.properties" />
</else>
</if>
<tstamp>
<format property="time.stamp.bundle.string" pattern="dd-MMM-yyyy" locale="en" />
</tstamp>
<zip destfile="${dist}/${dist.file}-${tck.version}_${time.stamp.bundle.string}.zip">
<zipfileset dir="${basedir}" includes="*.xml, build.properties, classes/**,
lib/*.jar, glassfish-tck-runner/**, readme.txt, *.sig, password.template"
excludes="domain*.xml, lib/sigtestdev.jar, glassfish-tck-runner/target/**, glassfish-tck-runner/target*/**, glassfish-tck-runner/src/test/tck20/tck-tests_*" prefix="cdi-tck-glassfish-porting" />
<zipfileset dir="${basedir}" includes="${prop.file}" fullpath="cdi-tck-glassfish-porting/build.properties" />
</zip>
<delete file="${basedir}/build.properties.sani" quiet="true" />
</target>
<target name="dist.sani">
<edit.prop.file />
<antcall target="dist" />
</target>
<macrodef name="edit.prop.file">
<sequential>
<loadfile srcfile="${basedir}/build.properties" property="props" />
<propertyregex property="porting.home.prop"
input="${props}"
regexp="(porting.home=)(.*)"
replace="\1"
defaultvalue="${props}"
override="true"/>
<propertyregex property="glassfish.home.prop"
input="${porting.home.prop}"
regexp="(glassfish.home=)(.*)"
replace="\1"
defaultvalue="${porting.home.prop}"
override="true"/>
<echo message="${glassfish.home.prop}"
file="${basedir}/build.properties.sani"/>
</sequential>
</macrodef>
<!-- Targets used to config V4 to run the CDI TCK -->
<!--
Attempt to stop the domain, if it is running, using the stopserv script. Note,
using asadmin stop-domain from within ant currently does not work. It assumes the
domain lives in /var/appserver/domains and there does not seem to be a way to fix
this. All attempts at using the domaindir option failed. This may be a bug in
asamdin or an antism since asadmin stop-domain works fine on the command line.
-->
<presetdef name="stop.domain">
<if>
<os family="unix" />
<then>
<exec dir="${glassfish.home}/bin" executable="${glassfish.home}/bin/stopserv">
<env key="PATH" path="${java.home}/bin${pathsep}${env.PATH}" />
</exec>
<sleep seconds="2" />
</then>
<elseif>
<or>
<os family="windows" />
<os family="dos" />
</or>
<then>
<exec dir="${glassfish.home}/bin" executable="${glassfish.home}/bin/stopserv.bat">
<env key="PATH" path="${java.home}/bin${pathsep}${env.PATH}" />
</exec>
<sleep seconds="2" />
</then>
</elseif>
<else>
<!-- should not happen -->
<echo>ERROR, Neither Winows nor Unix</echo>
</else>
</if>
</presetdef>
<presetdef name="start.domain">
<if>
<os family="unix" />
<then>
<exec dir="${glassfish.home}/bin" executable="${glassfish.home}/bin/startserv" spawn="true">
<env key="PATH" path="${java.home}/bin${pathsep}${env.PATH}" />
</exec>
<sleep seconds="2" />
</then>
<elseif>
<or>
<os family="windows" />
<os family="dos" />
</or>
<then>
<exec dir="${glassfish.home}/bin" executable="${glassfish.home}/bin/startserv.bat" spawn="true">
<env key="PATH" path="${java.home}/bin${pathsep}${env.PATH}" />
</exec>
<sleep seconds="2" />
</then>
</elseif>
<else>
<!-- should not happen -->
<echo>ERROR, Neither Winows nor Unix</echo>
</else>
</if>
</presetdef>
<macrodef name="edit.domain.xml">
<sequential>
<property name="domain.file" value="${glassfish.home}/domains/domain1/config/domain.xml" />
<copy file="${domain.file}" tofile="${domain.file}.original" failonerror="false" />
<loadfile property="domain.file.contents" srcfile="${domain.file}" />
<propertyregex property="heap.found" input="${domain.file.contents}"
regexp="<jvm-options>-Xmx(.*)</jvm-options>"
replace="<jvm-options>-Xmx${max.heap.size}</jvm-options>"
defaultvalue="true" />
<if>
<istrue value="${heap.found}" />
<then>
<echo>Max heap VM option not found in java-config.</echo>
</then>
<else>
<echo>Setting max heap value to ${max.heap.size}</echo>
<echo message="${heap.found}" file="${domain.file}" />
<echo>${domain.file} written to disk.</echo>
</else>
</if>
<loadfile property="domain.file.contents2" srcfile="${domain.file}" />
<propertyregex property="perm.gen.found" input="${domain.file.contents2}"
regexp="<jvm-options>-XX:MaxPermSize=(.*)</jvm-options>"
replace="<jvm-options>-XX:MaxPermSize=${max.perm.gen.size}</jvm-options>"
defaultvalue="true" />
<if>
<istrue value="${perm.gen.found}" />
<then>
<echo>Max permgen VM option not found in java-config.</echo>
</then>
<else>
<echo>Setting max permgen value to ${max.perm.gen.size}</echo>
<echo message="${perm.gen.found}" file="${domain.file}" />
<echo>${domain.file} written to disk.</echo>
</else>
</if>
<loadfile property="domain.file.contents3" srcfile="${domain.file}" />
<propertyregex property="ea.set" input="${domain.file.contents3}"
regexp="<jvm-options>-ea</jvm-options>"
select="true"
defaultvalue="false" />
<if>
<isfalse value="${ea.set}" />
<then>
<propertyregex property="java.config" input="${domain.file.contents3}"
regexp="(</java-config>)"
replace="<jvm-options>-ea:org.jboss.cdi.tck...</jvm-options>\1"
defaultvalue="true" />
<if>
<istrue value="${java.config}" />
<then>
<echo>java-config NOT found, something bad happened.</echo>
</then>
<else>
<echo>Adding -ea VM option to java-config.</echo>
<echo message="${java.config}" file="${domain.file}" />
<echo>${domain.file} written to disk.</echo>
</else>
</if>
</then>
<else>
<echo>-ea VM option already set in java-config, so not setting.</echo>
</else>
</if>
<if>
<or>
<os family="windows" />
<os family="dos" />
</or>
<then>
<property name="serverpolicy.file" value="${glassfish.home}/domains/domain1/config/server.policy" />
<mkdir dir="c:\\tmp" />
<mkdir dir="c:\\t" />
<replace file="${domain.file}" value="c:\\t">
<replacetoken>${com.sun.aas.instanceRoot}/applications</replacetoken>
</replace>
<replace file="${serverpolicy.file}" value="c:\\t">
<replacetoken>${com.sun.aas.instanceRoot}/applications</replacetoken>
</replace>
</then>
</if>
</sequential>
</macrodef>
<target name="stop.v4.domain">
<stop.domain />
</target>
<target name="restart.v4.domain">
<echo message="Restarting the Glassfish domain"/>
<stop.domain />
<start.domain />
<waitfor maxwait="${wait.for.v4}" maxwaitunit="second" checkevery="1" checkeveryunit="second">
<socket server="${admin.host}" port="${admin.port}"/>
</waitfor>
<echo>Domain started.</echo>
</target>
<target name="start.javadb">
<echo message="*** Starting JavaDB "/>
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${javadb.home}/lib/derby.jar${pathsep}${javadb.home}/lib/derbynet.jar${pathsep}${javadb.home}/lib/derbytools.jar${pathsep}${javadb.home}/lib/derbyclient.jar" fork="true" spawn="true">
<sysproperty key="derby.system.home" value="${javadb.home}/databases"/>
<sysproperty key="java.security.manager" value=""/>
<sysproperty key="java.security.policy" value="${glassfish.home}/domains/domain1/config/server.policy"/>
<arg line="-h ${javadb.host} -p ${javadb.port} start"/>
</java>
<sleep seconds="4"/>
<echo message="*** JavaDB Started "/>
</target>
<target name="stop.javadb">
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${javadb.home}/lib/derby.jar${pathsep}${javadb.home}/lib/derbynet.jar${pathsep}${javadb.home}/lib/derbytools.jar${pathsep}${javadb.home}/lib/derbyclient.jar" fork="true" spawn="true">
<arg line="-h ${javadb.host} -p ${javadb.port} shutdown"/>
</java>
<echo message="*** JavaDB Stopped "/>
</target>
<target name="clean">
<delete dir="${porting.home}/glassfish-tck-runner/target" quiet="true" />
<echo message="*** Deleted ${porting.home}/glassfish-tck-runner/target"/>
<delete dir="${porting.home}/reports" quiet="true" />
<echo message="*** Deleted ${porting.home}/reports"/>
</target>
<target name="config.v4">
<stop.domain />
<if>
<or>
<os family="windows"/>
<os family="dos"/>
</or>
<then>
<mvn.dependency.win dir="glassfish-tck-runner"/>
</then>
<else>
<mvn.dependency dir="glassfish-tck-runner"/>
</else>
</if>
<antcall target="copy.tck.ext.lib.jar"/>
<antcall target="clean" />
<edit.domain.xml />
<start.domain />
<echo>Checking for a socket on ${admin.host} at port ${admin.port}, will wait up to ${wait.for.v4} seconds</echo>
<waitfor maxwait="${wait.for.v4}" maxwaitunit="second" checkevery="1" checkeveryunit="second">
<socket server="${admin.host}" port="${admin.port}"/>
</waitfor>
<echo>Domain started.</echo>
<ant antfile="glassfish.xml" target="add.jvm.options"/>
<ant antfile="glassfish.xml" target="enable.jms"/>
<ant antfile="glassfish.xml" target="set.implicit.cdi"/>
<ant antfile="glassfish.xml" target="add.cdi.tck.users"/>
<antcall target="stop.javadb" />
<antcall target="start.javadb" />
<stop.domain/>
</target>
<presetdef name="mvn.test">
<exec executable="${maven.executable}">
<arg value="-P" />
<arg value="payara-managed" />
<arg value="-U" />
<arg value="clean" />
<arg value="test" />
<!--<arg value="-DtckTest=MessageDrivenBeanContextTest" />-->
</exec>
</presetdef>
<presetdef name="mvn.test.win">
<exec executable="cmd">
<arg value="/c"/>
<arg value="${maven.executable}.cmd"/>
<arg value="-P" />
<arg value="payara-managed" />
<arg value="-U" />
<arg value="test" />
</exec>
</presetdef>
<presetdef name="mvn.install">
<exec executable="${maven.executable}">
<arg value="install" />
<!--<arg value="-DtckTest=MessageDrivenBeanContextTest" />-->
</exec>
</presetdef>
<presetdef name="mvn.install.win">
<exec executable="cmd">
<arg value="/c"/>
<arg value="${maven.executable}.cmd"/>
<arg value="install"/>
</exec>
</presetdef>
<presetdef name="mvn.dependency">
<exec executable="${maven.executable}">
<arg value="dependency:get" />
<arg value="-DrepositoryUrl=https://repo1.maven.org/maven2/"/>
<arg value="-DgroupId=org.jboss.cdi.tck"/>
<arg value="-DartifactId=cdi-tck-ext-lib"/>
<arg value="-Dversion=${cdiext.version}"/>
<!--<arg value="-DtckTest=MessageDrivenBeanContextTest" />-->
</exec>
</presetdef>
<presetdef name="mvn.dependency.win">
<exec executable="cmd">
<arg value="/c"/>
<arg value="${maven.executable}.cmd"/>
<arg value="dependency:get"/>
<arg value="-DrepositoryUrl=https://repo1.maven.org/maven2/"/>
<arg value="-DgroupId=org.jboss.cdi.tck"/>
<arg value="-DartifactId=cdi-tck-ext-lib"/>
<arg value="-Dversion=${cdiext.version}"/>
</exec>
</presetdef>
</project>