forked from adoptium/aqa-tests
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
395 lines (367 loc) · 14.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
<?xml version="1.0"?>
<!--
# Licensed 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="jck" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>Build JCK Tests</description>
<!-- set global properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/jck" />
<property environment="env" />
<condition property="isZOS" value="true">
<os family="z/os" />
</condition>
<condition property="git-prefix" value="git" else="https">
<isset property="isZOS"/>
</condition>
<condition property="is_windows" value="true" else="false" >
<os family="windows" />
</condition>
<condition property="src-encoding" value="IBM-1047" else="UTF-8">
<isset property="isZOS"/>
</condition>
<set-property name="JCK_GIT_BRANCH_ISSET" if-property-isset="env.JCK_GIT_BRANCH"/>
<condition property="jck_branch" value="${env.JCK_GIT_BRANCH}" else="main">
<isset property="JCK_GIT_BRANCH_ISSET"/>
</condition>
<property name="jtrunner_src_dir" value="${TEST_ROOT}/jck/jtrunner"/>
<property name="jtrunner_bin_dir" value="${jtrunner_src_dir}/bin" />
<!-- Setup properties to allow projects to use a copy of Visual Studio for compiling native test cases. -->
<!-- Look for either version 10.0 or 14.0 in the default installation location. -->
<!-- To use a different location property rtb.vcvarsall_filename needs to be set on the command line for the build. -->
<!-- The vcvarsall.bat file argument amd64 is added if the javac being used to compile the java classes is a 64 bit java. -->
<property name="vs14_vcvarsall_filename" location="c:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat"/>
<available file="${vs14_vcvarsall_filename}" property="vs14_available"/>
<property name="vs10_vcvarsall_filename" location="c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat"/>
<available file="${vs10_vcvarsall_filename}" property="vs10_available"/>
<property name="vs22_pro_vcvarsall_filename" location="c:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat"/>
<available file="${vs22_pro_vcvarsall_filename}" property="vs22_pro_available"/>
<property name="vs22_bt_vcvarsall_filename" location="c:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat"/>
<available file="${vs22_bt_vcvarsall_filename}" property="vs22_bt_available"/>
<condition property="vcvarsall_filename" value="${vs14_vcvarsall_filename}">
<and>
<isset property="vs14_available"/>
<not>
<equals arg1="${os.arch}" arg2="aarch64" trim="true"/>
</not>
</and>
</condition>
<condition property="vcvarsall_filename" value="${vs10_vcvarsall_filename}">
<and>
<isset property="vs10_available"/>
<not>
<equals arg1="${os.arch}" arg2="aarch64" trim="true"/>
</not>
</and>
</condition>
<condition property="vcvarsall_filename" value="${vs22_pro_vcvarsall_filename}">
<isset property="vs22_pro_available"/>
</condition>
<condition property="vcvarsall_filename" value="${vs22_bt_vcvarsall_filename}">
<isset property="vs22_bt_available"/>
</condition>
<condition property="windows_native_compiler_present" value="true">
<isset property="vcvarsall_filename"/>
</condition>
<condition property="vcvarsall_bits_arg" value="arm64">
<equals arg1="${os.arch}" arg2="aarch64" trim="true"/>
</condition>
<condition property="vcvarsall_bits_arg" value="amd64" else="">
<and>
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
<not>
<equals arg1="${os.arch}" arg2="aarch64" trim="true"/>
</not>
</and>
</condition>
<condition property="setup_windows_build_env" value='call "${vcvarsall_filename}" ${vcvarsall_bits_arg} &&' else="">
<equals arg1="${is_windows}" arg2="true"/>
</condition>
<condition property="can_build_jck_natives_windows" value="true">
<and>
<available file="${jck_runtimes_src_dir}" type="dir"/>
<equals arg1="${is_windows}" arg2="true"/>
<equals arg1="${windows_native_compiler_present}" arg2="true"/>
</and>
</condition>
<condition property="can_build_jck_natives_unix" value="true">
<and>
<available file="${jck_runtimes_src_dir}" type="dir"/>
<not>
<equals arg1="${is_windows}" arg2="true"/>
</not>
</and>
</condition>
<target name="stage-jck-material">
<!-- Starting downloading or updating JCK materials based on JCK GIT REPO and JCK VERSION-->
<if>
<available file="${JCK_ROOT_USED}" type="dir" />
<then>
<if>
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<then>
<echo message="env.SKIP_JCK_GIT_UPDATE is set to true. Skip Running git checks at ${JCK_ROOT_USED}. Continue." />
</then>
<else>
<!--Obtain local and remote SHA to figure out if local materials are up-to-date-->
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false" outputproperty="localSHA" resultproperty="return.code">
<arg line="rev-parse"/>
<arg line="HEAD"/>
</exec>
<if>
<not>
<equals arg1="${return.code}" arg2="0"/>
</not>
<then>
<echo message="Error: Git command failed with return code ${return.code}. Delete the directory and continue." />
<delete dir="${JCK_ROOT_USED}" failonerror="true" />
</then>
<else>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true" outputproperty="remoteSHA">
<arg line="ls-remote"/>
<arg line="${JCK_GIT_REPO_USED}"/>
<arg line="${jck_branch}"/>
</exec>
<loadresource property="localSHATrimmed">
<propertyresource name="localSHA"/>
<filterchain>
<tokenfilter>
<trim/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadresource>
<echo message="LocalSHA = --${localSHATrimmed}--"/>
<echo message="RemoteSHA= --${remoteSHA}--"/>
<condition property="local-material-uptodate">
<contains string="${remoteSHA}" substring="${localSHATrimmed}" />
</condition>
</else>
</if>
</else>
</if>
</then>
</if>
<if>
<not>
<available file="${JCK_ROOT_USED}" type="dir" />
</not>
<!-- jck materials don't exist, download them -->
<then>
<echo message="${JCK_ROOT_USED} does not exist,
clone from ${JCK_GIT_REPO_USED}, ${jck_branch} branch, to ${JCK_ROOT_USED}" />
<mkdir dir="${JCK_ROOT_USED}/.." />
<exec executable="git" dir="${JCK_ROOT_USED}/.." failonerror="true">
<arg value="clone" />
<arg value="--single-branch" />
<arg value="-b"/>
<arg value="${jck_branch}"/>
<arg value="${JCK_GIT_REPO_USED}" />
<arg value="${JCK_ROOT_USED}" />
</exec>
</then>
<!-- jck materials exist, update jck materials if needed-->
<else>
<if>
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<!-- don't want to update local JCK materials -->
<then>
<echo message="env.SKIP_JCK_GIT_UPDATE is set to true. Skip Running git update at ${JCK_ROOT_USED}. Continue." />
</then>
<else>
<if>
<isset property="local-material-uptodate" />
<then>
<echo message="Local JCK materials up-to-date. Skipping update"/>
</then>
<else>
<if>
<available file="${JCK_ROOT_USED}/natives" type="dir" />
<then>
<echo message="Deleting ${JCK_ROOT_USED}/natives..." />
<delete includeEmptyDirs="true">
<fileset dir="${JCK_ROOT_USED}/natives"/>
</delete>
</then>
</if>
<echo message="Updating ${JCK_ROOT_USED} with latest..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false" resultproperty="return.code">
<arg value="pull" />
<arg value="${JCK_GIT_REPO_USED}" />
<arg value="${jck_branch}" />
</exec>
<if>
<not>
<equals arg1="${return.code}" arg2="0"/>
</not>
<then>
<echo message="Performing hard reset..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="reset" />
<arg value="--hard" />
<arg value="origin/main" />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="clean" />
<arg value="-f" />
<arg value="-d" />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="pull" />
<arg value="${JCK_GIT_REPO_USED}" />
<arg value="${jck_branch}" />
</exec>
</then>
</if>
</else>
</if>
</else>
</if>
</else>
</if>
<if>
<isset property="isZOS" />
<then>
<if>
<isset property="local-material-uptodate"/>
<then>
<echo message="Local JCK materials up-to-date. Skipping hard reset"/>
</then>
<else>
<echo message="Performing hard reset of ${JCK_ROOT_USED} using .gitattributes.zos for file conversions..."/>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${JCK_ROOT_USED}/.git/info" includes="**/*"/>
</delete>
<mkdir dir="${JCK_ROOT_USED}/.git/info" />
<move file="${JCK_ROOT_USED}/.gitattributes.zos" tofile="${JCK_ROOT_USED}/.git/info/attributes" />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="rm" />
<arg value="--cached" />
<arg value="-r" />
<arg value="-q" />
<arg value="." />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="reset" />
<arg value="--hard" />
</exec>
</else>
</if>
</then>
</if>
</target>
<target name="build-jck-natives" depends="setup-native-build-command, build-natives-windows, build-natives-unix">
</target>
<target name="setup-native-build-command">
<echo message="Building jck natives"/>
<property name="openjdk_test_jck_native_build_command" value='${setup_windows_build_env}make build -f ${jtrunner_src_dir}/makefile SRCDIR=${jck_runtimes_src_dir} JAVA_HOME=${TEST_JDK_HOME} OUTDIR=${JCK_ROOT_USED}/natives'/>
<tempfile property="openjdk_test_jck_native_build_command_file" destDir="${java.io.tmpdir}" prefix="openjdk.build.command."/>
</target>
<target name="build-natives-windows" if="can_build_jck_natives_windows">
<echo message="${openjdk_test_jck_native_build_command}" file="${openjdk_test_jck_native_build_command_file}.bat"/>
<exec executable="${openjdk_test_jck_native_build_command_file}.bat" failonerror="true"/>
<delete file="${openjdk_test_jck_native_build_command_file}.bat" verbose="true"/>
</target>
<target name="build-natives-unix" if="can_build_jck_natives_unix">
<echo message="${openjdk_test_jck_native_build_command}" file="${openjdk_test_jck_native_build_command_file}.sh"/>
<exec executable="/bin/sh" failonerror="true">
<arg value="${openjdk_test_jck_native_build_command_file}.sh"/>
</exec>
<delete file="${openjdk_test_jck_native_build_command_file}.sh" verbose="true"/>
</target>
<target name="build-jtrunner" depends="build-jck-natives, create-bin-dir">
<javac srcdir="${jtrunner_src_dir}"
destdir="${jtrunner_bin_dir}"
fork="true"
debug="true"
encoding="ISO-8859-1"
includeantruntime="false"
failonerror="true">
<compilerarg value="-Xlint:deprecation,unchecked" />
<include name="**/*.java"/>
</javac>
</target>
<target name="dist" depends="build-jtrunner" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${basedir}">
<exclude name="jck_root/" />
<exclude name="README.md" />
</fileset>
</copy>
</target>
<target name="build">
<if>
<equals arg1="${env.SKIP_JCK_GIT_UPDATE}" arg2="true"/>
<then>
<echo message="=== SKIP_JCK_GIT_UPDATE set to true, not enforcing existence of env.JCK_GIT_REPO ===" />
</then>
<else>
<fail message="env.JCK_GIT_REPO: ${env.JCK_GIT_REPO} was not correctly set for running JCK tests. If you do not want to compile JCK tests,
please use BUILD_LIST to include test folders you want to test.">
<condition>
<not>
<isset property="env.JCK_GIT_REPO"/>
</not>
</condition>
</fail>
</else>
</if>
<propertyregex property="JCK_GIT_REPO_USED" input="${env.JCK_GIT_REPO}" regexp="JCKnext-unzipped.git" replace="JCK${JDK_VERSION}-unzipped.git" casesensitive="false" defaultValue="${env.JCK_GIT_REPO}"/>
<echo>=== JCK_GIT_REPO_USED is set to ${JCK_GIT_REPO_USED} ===</echo>
<condition property="JCK_ROOT_RELATIVE_PATH" value="${env.JCK_ROOT}" else="${basedir}/../../../../jck_root/JCK${JDK_VERSION}-unzipped">
<isset property="env.JCK_ROOT" />
</condition>
<property name="JCK_ROOT_USED" location="${JCK_ROOT_RELATIVE_PATH}"/>
<echo>=== JCK_ROOT_USED is set to ${JCK_ROOT_USED} ===</echo>
<set-property name="JCK_VERSION_ISSET" if-property-isset="env.JCK_VERSION"/>
<if>
<isset property="JCK_VERSION_ISSET" />
<then>
<property name="JCK_VERSION_USED" value="${env.JCK_VERSION}" />
</then>
<else>
<if>
<equals arg1="${JDK_VERSION}" arg2="8" />
<then>
<property name="JCK_VERSION_USED" value="jck8d" />
</then>
<else>
<if>
<equals arg1="${JDK_VERSION}" arg2="11" />
<then>
<property name="JCK_VERSION_USED" value="jck11a" />
</then>
<else>
<property name="JCK_VERSION_USED" value="jck${JDK_VERSION}" />
</else>
</if>
</else>
</if>
</else>
</if>
<echo>=== JCK_VERSION_USED is set to ${JCK_VERSION_USED} ===</echo>
<propertyregex property="jck_short_version" input="${JCK_VERSION_USED}" regexp="jck([^\.]*)" select="\1" casesensitive="false" />
<property name="jck_runtimes_src_dir" value="${JCK_ROOT_USED}/JCK-runtime-${jck_short_version}"/>
<echo>start staging jck materials</echo>
<antcall target="stage-jck-material" inheritall="true" />
<echo>start building Javatest Runner and jck natives</echo>
<antcall target="dist" inheritall="true" />
</target>
<target name="create-bin-dir">
<mkdir dir="${jtrunner_bin_dir}"/>
</target>
<target name="clean">
<ant antfile="${SYSTEMTEST_ROOT}/aqa-systemtest/openjdk.build/build.xml" dir="${SYSTEMTEST_ROOT}/aqa-systemtest/openjdk.build" inheritAll="false" target="clean"></ant>
<ant antfile="${SYSTEMTEST_ROOT}/stf/stf.build/build.xml" dir="${SYSTEMTEST_ROOT}/stf/stf.build" inheritAll="false" target="clean"></ant>
</target>
</project>