/
build.xml
331 lines (284 loc) · 11.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017, 2018 Oracle 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
-->
<!--
$Id$
-->
<project name="TS top level" default="usage">
<import file="xml/ts.top.import.xml" optional="true"/>
<import file="../../../bin/xml/ts.top.import.xml" optional="true"/>
<property name="all.test.dir" value="
com/sun/ts/tests/signaturetest/jsonb,
com/sun/ts/tests/jsonb"/>
<!-- run.test.dir - all tests except the SPI plugin tests -->
<property name="run.test.dir" value="
com/sun/ts/tests/signaturetest/jsonb,
com/sun/ts/tests/jsonb/api,
com/sun/ts/tests/jsonb/defaultmapping,
com/sun/ts/tests/jsonb/customizedmapping"/>
<!-- run.all - runs all tests except the SPI plugin tests -->
<target name="run.all" description="Runs all tests (except pluggability tests) in batch mode">
<property name="tests.string" value=""/>
<echo message="Running all tests from the following directories..."/>
<for list="${run.test.dir}" param="ii" trim="true">
<sequential>
<var name="tests.string" value="${tests.string} @{ii}"/>
</sequential>
</for>
<!-- We want both runclient, run.pluggability and run.report to run so put in try/catch block -->
<trycatch>
<try>
<antcall target="runclient"/>
</try>
<catch>
<echo message="Ensure run.pluggability is called"/>
</catch>
<finally>
<trycatch>
<try>
<antcall target="run.pluggability" />
</try>
<catch>
<echo message="Ensure run.report is called."/>
</catch>
<finally>
<antcall target="run.report" />
</finally>
</trycatch>
</finally>
</trycatch>
</target>
<!-- run.pluggability - runs the SPI plugin tests -->
<target name="run.pluggability" description="Runs the pluggability tests to verify SPI in batch mode">
<echo message="Running pluggability tests to verify spi plugin mechanism to our own JsonProvider class ..."/>
<antcall target="enable.alternate.jsonb.provider" />
<trycatch>
<try>
<!-- Override previous list of tests to execute. -->
<var name="tests.string" value="com/sun/ts/tests/jsonb/pluggability"/>
<ant antfile="build.xml" dir="${ts.home}/src/com/sun/ts/tests/jsonb/pluggability" target="runclient" />
</try>
<catch>
<echo message="Ensure disable.alternate.jsonb.provider is called"/>
</catch>
<finally>
<antcall target="disable.alternate.jsonb.provider" />
</finally>
</trycatch>
</target>
<!-- enable.alternate.jsonb.provider
Enable our JsonProvider by ensuring our service class is in classpath before RI jars.
-->
<target name="enable.alternate.jsonb.provider" depends="translatepath" description="Enable the alternate jsonb provider for the pluggability tests">
<echo message="Enable our alternate JsonProvider class for the pluggability tests ..."/>
<replaceregexp file="${bin.dir}/ts.jte"
match="jsonb.alt.provider.classes=.*"
replace="jsonb.alt.provider.classes=$${ts.home}/lib/jsonb_alternate_provider.jar" />
</target>
<!-- disable.alternate.jsonb.provider
Disable our JsonProvider by removing our service class from classpath.
-->
<target name="disable.alternate.jsonb.provider" description="Disable the alternate jsonb provider for the pluggability tests">
<echo message="Disable our alternate JsonProvider class for the pluggability tests ..."/>
<replaceregexp file="${bin.dir}/ts.jte"
match="jsonb.alt.provider.classes=.*"
replace="jsonb.alt.provider.classes=jsonb.alt.provider.classes" />
</target>
<target name="run.report" >
<echo message="Running JavaTest report followed by a summary report"/>
<antcall target="report"/>
<report.summary dirs="com/sun/ts/tests/jsonb,
com/sun/ts/tests/signaturetest/jsonb"/>
</target>
<!--
run.fileutfconverter
Utility program for converting a UTF-8 file to various UTF encoded files
and vice-versa.
file
Takes the following properties on command line:
o tofrom
o encoding
o infile
o outfile
Examples)
Convert a UTF-8 file (fooUTF8) to encoding (UTF-16) and write to file (fooUTF16)
ant -Dtofrom=-toUTF -Dencoding=UTF-16 -Dinfile=fooUTF8 -Doutfile=fooUTF16 run.fileutfconverter
Convert a UTF-16 encoded file (fooUTF16) from encoding (UTF-16) and write to UTF-8 file (fooUTF8)
ant -Dtofrom=-fromUTF -Dencoding=UTF-16 -Dinfile=fooUTF16 -Doutfile=fooUTF8 run.fileutfconverter
-->
<target name="run.fileutfconverter" description="Run the FileUTFConverter utility">
<if>
<and>
<isset property="tofrom"/>
<isset property="encoding"/>
<isset property="infile"/>
<isset property="outfile"/>
</and>
<then>
<echo message="Running FileUTFConverter utility"/>
<java fork="true"
failonerror="false"
classname="com.sun.ts.tests.jsonp.util.FileUTFConverter"
classpath="${ts.home}/classes">
<arg line="${tofrom} ${encoding} ${infile} ${outfile}"/>
</java>
</then>
<else>
<echo message="Examples:"/>
<echo message="--------"/>
<echo message="Convert a UTF-8 file (fooUTF8) to encoding (UTF-16) and write to file (fooUTF16)"/>
<echo message="ant -Dtofrom=-toUTF -Dencoding=UTF-16 -Dinfile=fooUTF8 -Doutfile=fooUTF16 run.fileutfconverter"/>
<echo message=""/>
<echo message="Convert a UTF-16 encoded file (fooUTF16) from encoding (UTF-16) and write to UTF-8 file (fooUTF8)"/>
<echo message="ant -Dtofrom=-fromUTF -Dencoding=UTF-16 -Dinfile=fooUTF16 -Doutfile=fooUTF8 run.fileutfconverter"/>
</else>
</if>
</target>
<!--
run.stringutfconverter
Utility program for converting a string to various UTF encoded files.
file
Takes the following properties on command line:
o instring
o encoding
o outfile
Examples)
Convert a string ("foo") to encoding (UTF-16LE) and write to file (fooUTF16LE)
ant -Dinstring="foo" -Dencoding=UTF-16LE -Doutfile=fooUTF16LE run.stringutfconverter
-->
<target name="run.stringutfconverter" description="Run the StringUTFConverter utility">
<if>
<and>
<isset property="instring"/>
<isset property="encoding"/>
<isset property="outfile"/>
</and>
<then>
<echo message="Running StringUTFConverter utility"/>
<java fork="true"
failonerror="false"
classname="com.sun.ts.tests.jsonp.util.StringUTFConverter"
classpath="${ts.home}/classes">
<arg line="${instring} ${encoding} ${outfile}"/>
</java>
</then>
<else>
<echo message="Examples:"/>
<echo message="--------"/>
<echo message="Convert a string (foo) to encoding (UTF-16LE) and write to file (fooUTF16LE)"/>
<echo message="ant -Dinstring=foo -Dencoding=UTF-16LE -Doutfile=fooUTF16LE run.stringutfconverter"/>
</else>
</if>
</target>
<!--
run.myencoder
Used to generate an encoded file preceded by N null characters.
This utility takes a valid UTF-8 Json text file as input and generates
a encoded version as output file with N null characters preceded by
each character. For empty files it will just output the N null chars.
Example)
Read a UTF-8 (foo8) input file and generate an encoded version to output file (fooencoded) with each character preceded by N nulls.
ant -Dnulls=4 -Dinfile=foo8 -Doutfile=fooencoded run.myencoder
-->
<target name="run.myencoder" description="Run the MyEncoder utility">
<if>
<and>
<isset property="nulls"/>
<isset property="infile"/>
<isset property="outfile"/>
</and>
<then>
<echo message="Running MyEncoder utility"/>
<java fork="true"
failonerror="false"
classname="com.sun.ts.tests.jsonp.util.MyEncoder"
classpath="${ts.home}/classes">
<arg line="${nulls} ${infile} ${outfile}"/>
</java>
</then>
<else>
<echo message="Example:"/>
<echo message="-------"/>
<echo message="Read a UTF-8 (foo8) input file and generate an encoded version to output file (fooencoded) with each character preceded by N nulls"/>
<echo message="ant -Dnulls=4 -Dinfile=foo8 -Doutfile=fooencoded run.myencoder"/>
</else>
</if>
</target>
<target name="translatepath">
<translatepath propname="ts.classpath" />
<translatepath propname="bin.dir" />
</target>
<target name="buildsmoketests" description="Builds only the smoke tests">
<if>
<available file="${bin.dir}/smoke.xml" type="file" property="smoke.file.exists"/>
<then>
<ant antfile="${bin.dir}/smoke.xml" target="build" />
</then>
<else>
<echo message="*** This feature is not enabled ***"/>
</else>
</if>
</target>
<target name="runsmoketests" description="Runs only the smoke tests">
<if>
<available file="${bin.dir}/smoke.xml" type="file" property="smoke.file.exists"/>
<then>
<ant antfile="${bin.dir}/smoke.xml" target="smoke" />
</then>
<else>
<echo message="*** This feature is not enabled ***"/>
</else>
</if>
</target>
<!-- **************************************************************** -->
<!-- Tasks for managing ts specific jar -->
<!-- ts specific jar (in this case jsonptck.jar) will be created in
ts.home/lib. -->
<target name="tslib.clean" depends="translatepath">
<delete failonerror="false">
<fileset dir="${class.dir}">
<include name="${lib.pkg.dir}/deliverable/tck/**" />
<include name="${lib.pkg.dir}/deliverable/jsonb/**" />
<include name="${lib.pkg.dir}/implementation/sun/common/**" />
</fileset>
</delete>
<delete failonerror="false" file="${ts.home}/lib/${tslib.name}"/>
</target>
<target name="tslib.compile" depends="tslib.clean">
<ts.javac includes="${lib.pkg.dir}/deliverable/tck/**
${lib.pkg.dir}/deliverable/jsonb/**
${lib.pkg.dir}/implementation/sun/common/SunRIURL.java">
<classpath>
<pathelement path="${ts.harness.classpath}" />
</classpath>
</ts.javac>
</target>
<target name="tslib" depends="tslib.compile">
<tstamp/>
<ts.lib.jar>
<include name="${lib.pkg.dir}/deliverable/tck/**" />
<include name="${lib.pkg.dir}/deliverable/jsonb/**" />
<include name="${lib.pkg.dir}/implementation/sun/common/SunRIURL.class" />
</ts.lib.jar>
</target>
<target name="jte.cleanup">
<props.sanitizer file="${bin.dir}/ts.jte" quiet="true">
<property name="jsonb.classes" value="" />
<property name="jsonb.resources" value="$${ts.home}/src/com/sun/ts/tests/jsonb/resources" />
<property name="jsonb.alt.provider.classes" value="jsonb.alt.provider.classes" />
</props.sanitizer>
</target>
<target name="config.vi">
<ant antfile="${bin.dir}/xml/impl/${impl.vi}/config.vi.xml" target="config.vi" />
</target>
</project>