-
-
Notifications
You must be signed in to change notification settings - Fork 317
/
Copy pathbuild.xml
executable file
·250 lines (240 loc) · 8.62 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
<?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="openjdk regression tests" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<description>
stage openjdk test make files
</description>
<!-- set properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/openjdk"/>
<property name="src" location="."/>
<property environment="env"/>
<if>
<contains string="${SPEC}" substring="win"/>
<then>
<path id="home.path">
<pathelement path="${env.HOME}"/>
</path>
<pathconvert targetos="unix" property="home.unix" refid="home.path"/>
<echo message="pathconvert ${env.HOME} to unix on windows. home.unix is set to ${home.unix}"/>
</then>
<else>
<property name="home.unix" value="${env.HOME}"/>
</else>
</if>
<property name="REFERENCE_REPO" value="--reference-if-able ${home.unix}/openjdk_cache"/>
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml"/>
<target name="getOpenjdk" depends="openjdk-jdk.check" unless="jdkdir.exists">
<!-- Windows API limitation of file paths having 260 characters or fewer,
run the config command to allow file paths of 4096 characters
-->
<if>
<contains string="${SPEC}" substring="win"/>
<then>
<exec executable="git" failonerror="false">
<arg line="config --global core.longpaths true"/>
</exec>
</then>
</if>
<set-property name="JDK_REPO_ISSET" if-property-isset="env.JDK_REPO"/>
<set-property name="JDK_BRANCH_ISSET" if-property-isset="env.JDK_BRANCH"/>
<set-property name="OPENJDK_SHA_ISSET" if-property-isset="env.OPENJDK_SHA"/>
<if>
<and>
<isset property="JDK_REPO_ISSET"/>
<isset property="JDK_BRANCH_ISSET"/>
</and>
<then>
<echo>Using user specified repo and branch</echo>
<if>
<contains string="${SPEC}" substring="zos"/>
<then>
<propertyregex property="JDK_REPO_SPECIFIC" input="${env.JDK_REPO}" regexp="https://github.ibm.com/" replace="git@github.ibm.com:" defaultValue="${env.JDK_REPO}"/>
</then>
<else>
<property name="JDK_REPO_SPECIFIC" value="${env.JDK_REPO}"/>
</else>
</if>
<if>
<isset property="OPENJDK_SHA_ISSET"/>
<then>
<getFileWithRetry file="openjdktemp" command="git clone -q ${REFERENCE_REPO} -b ${env.JDK_BRANCH} ${JDK_REPO_SPECIFIC} openjdktemp"/>
<exec executable="git" failonerror="true" dir="openjdktemp">
<arg line="checkout ${env.OPENJDK_SHA}"/>
</exec>
</then>
<else>
<getFileWithRetry file="openjdktemp" command="git clone --depth 1 -q ${REFERENCE_REPO} -b ${env.JDK_BRANCH} ${JDK_REPO_SPECIFIC} openjdktemp"/>
<if>
<equals arg1="${failCode}" arg2="128"/>
<then>
<getFileWithRetry file="openjdktemp" command="git clone -q ${JDK_REPO_SPECIFIC} openjdktemp"/>
<echo message="git rev-parse ${env.JDK_BRANCH} "/>
<exec executable="git" failonerror="false" dir="openjdktemp" outputproperty="jdk_sha1" resultproperty="code">
<arg value="rev-parse"/>
<arg value="${env.JDK_BRANCH}"/>
</exec>
<if>
<equals arg1="${code}" arg2="128"/>
<then>
<echo message="git rev-parse origin/${env.JDK_BRANCH}"/>
<exec executable="git" failonerror="true" dir="openjdktemp" outputproperty="jdk_sha2" resultproperty="code2">
<arg value="rev-parse"/>
<arg value="origin/${env.JDK_BRANCH}"/>
</exec>
<property name="jdk_sha" value="${jdk_sha2}"/>
</then>
</if>
<if>
<not>
<isset property="jdk_sha"/>
</not>
<then>
<property name="jdk_sha" value="${jdk_sha1}"/>
</then>
</if>
<if>
<isset property="isZOS"/>
<then>
<propertyregex property="jdk_sha" input="${jdk_sha}" regexp="\n" replace="" override="true"/>
</then>
</if>
<echo message="git checkout -q -f ${jdk_sha} "/>
<exec executable="git" failonerror="true" dir="openjdktemp">
<arg value="checkout"/>
<arg value="-q"/>
<arg value="-f"/>
<arg value="${jdk_sha}"/>
</exec>
</then>
</if>
</else>
</if>
<if>
<contains string="${env.JDK_REPO}" substring="corretto"/>
<then>
<move file="openjdktemp/src" tofile="openjdk-jdk"/>
<delete dir="openjdktemp"/>
</then>
<else>
<move file="openjdktemp" tofile="openjdk-jdk"/>
</else>
</if>
</then>
<else>
<if>
<matches string="${JDK_IMPL}" pattern="openj9|ibm"/>
<then>
<if>
<equals arg1="${env.ORIGIN_JDK_VERSION}" arg2="next"/>
<then>
<property name="jdkName" value="openj9-openjdk-jdk"/>
</then>
<else>
<if>
<contains string="${SPEC}" substring="zos"/>
<then>
<property name="jdkName" value="openj9-openjdk-jdk${JDK_VERSION}-zos"/>
</then>
<else>
<property name="jdkName" value="openj9-openjdk-jdk${JDK_VERSION}"/>
</else>
</if>
</else>
</if>
<if>
<contains string="${SPEC}" substring="zos"/>
<then>
<property name="regressionRepo" value="git@github.ibm.com:runtimes/${jdkName}.git"/>
</then>
<else>
<property name="regressionRepo" value="https://github.com/ibmruntimes/${jdkName}.git"/>
</else>
</if>
</then>
<else>
<if>
<and>
<contains string="${env.SPEC}" substring="arm"/>
<equals arg1="${JDK_VERSION}" arg2="8"/>
</and>
<then>
<property name="jdkName" value="aarch32-jdk8u"/>
</then>
<else>
<echo message="Using a git ls-remote command to determine if the jdk source repo has an available 'u' version yet."/>
<echo message="git ls-remote -h https://github.com/adoptium/jdk${JDK_VERSION}u.git"/>
<exec executable="git" resultproperty="repo.exist" failonerror="false" timeout="30000">
<env key="GIT_TERMINAL_PROMPT" value="0"/>
<arg line="ls-remote -h https://github.com/adoptium/jdk${JDK_VERSION}u.git"/>
</exec>
<if>
<equals arg1="${repo.exist}" arg2="0"/>
<then>
<echo message="Command passed. Setting repo name to the 'u' version."/>
<property name="jdkName" value="jdk${JDK_VERSION}u"/>
</then>
<else>
<echo message="Command failed, or tried to ask for a username due to access restrictions. Or both."/>
<echo message="Setting repo name to the non-'u' version."/>
<property name="jdkName" value="jdk${JDK_VERSION}"/>
</else>
</if>
</else>
</if>
<property name="regressionRepo" value="https://github.com/adoptium/${jdkName}.git"/>
</else>
</if>
<if>
<contains string="${JDK_IMPL}" substring="hotspot"/>
<then>
<!-- Adoptium nightly is using dev branch and default branch is master-->
<property name="defaultBranch" value="-b dev"/>
</then>
<else>
<property name="defaultBranch" value=""/>
</else>
</if>
<if>
<isset property="OPENJDK_SHA_ISSET"/>
<then>
<getFileWithRetry file="openjdk-jdk" command="git clone -q ${REFERENCE_REPO} ${defaultBranch} ${regressionRepo} openjdk-jdk"/>
<exec executable="git" failonerror="true" dir="openjdk-jdk">
<arg line="checkout ${env.OPENJDK_SHA}"/>
</exec>
</then>
<else>
<getFileWithRetry file="openjdk-jdk" command="git clone --depth 1 -q ${REFERENCE_REPO} ${defaultBranch} ${regressionRepo} openjdk-jdk"/>
</else>
</if>
</else>
</if>
<checkGitRepoSha repoDir="openjdk-jdk"/>
<addTestenvProperties repoDir="openjdk-jdk" repoName="JDK${env.JDK_VERSION}"/>
</target>
<target name="openjdk-jdk.check">
<condition property="jdkdir.exists">
<available file="openjdk-jdk" type="dir"/>
</condition>
</target>
<target name="dist" depends="getJtreg, getOpenjdk" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml,excludes/ProblemList*.txt,*.mk"/>
</copy>
</target>
<target name="build">
<antcall target="dist" inheritall="true"/>
</target>
</project>