-
Notifications
You must be signed in to change notification settings - Fork 0
/
getEBuilder.xml
255 lines (211 loc) · 7.45 KB
/
getEBuilder.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
A utility ant script get the eclipse builder from Git.
Hudson jobs can call this script from ant as one of it first build steps.
Such as, start with a wget fetch from CGit (where following $dash; is literally a '-',
it is escaped here just for XML rules against two dashes in a comment);
wget -O getEBuilder.xml ‐‐no-verbose https://download.eclipse.org/eclipse/relengScripts/production/testScripts/hudsonBootstrap/getEBuilder.xml
2>&1
Then use ant to invoke the functionality. Example:
ant -f getEBuilder.xml -EBUILDER_HASH=910fca82df3ea649ba8ee758259561582e13bf8b
-->
<project
name="getEBuilder"
default="getEBuilder"
basedir=".">
<target
name="init"
depends="initWorkspace"
unless="getEBuilderInitialized">
<!-- assign defaults if not on hudson, for local testing if nothing else -->
<property
name="WORKSPACE"
value="${basedir}" />
<condition
property="gitHost"
value="${env.GIT_HOST}"
else="git.eclipse.org">
<isset property="env.GIT_HOST" />
</condition>
<!-- normally provided by caller, but if not, assume master -->
<property
name="EBUILDER_HASH"
value="master" />
<!-- git is fall back, if no method set explicitly -->
<condition
property="fetchSource"
value="git">
<and>
<not>
<isset property="EBuilderlocal" />
</not>
<not>
<isset property="downloadURL" />
</not>
</and>
</condition>
<property
name="scmProject"
value="eclipse.platform.releng.aggregator" />
<property
name="folderName"
value="eclipse.platform.releng.aggregator" />
<property
name="eScriptLocation"
value="${folderName}/production/testScripts" />
<echo message="=== Properties in 'getEBuilder.xml'" />
<echo message=" WORKSPACE: ${WORKSPACE}" />
<echo message=" folderName: ${folderName}" />
<echo message=" eScriptLocation: ${eScriptLocation}" />
<echo message=" scmProject: ${scmProject}" />
<echo message=" EBUILDER_HASH: ${EBUILDER_HASH}" />
<echo message=" The following are used, in order (if defined), to get 'production scripts'" />
<echo message=" (fetchDirect from) downloadURL: ${downloadURL}" />
<echo message=" (copy from local cache directory) EBuilderlocal: ${EBuilderlocal}" />
<echo message=" fetchSource (from Git): ${fetchSource}" />
<property
name="getEBuilderInitialized"
value="true" />
</target>
<target
name="getEBuilder"
depends="init">
<!-- remove old one, if there, and make sure directory exists for
eventual checkout/copy/globmapper
-->
<delete dir="${WORKSPACE}/${folderName}" />
<mkdir dir="${WORKSPACE}/${folderName}" />
<antcall target="fetchEBuilder" />
<antcall target="EBuildercleanup" />
<ant antfile="${WORKSPACE}/${eScriptLocation}/runTests2.xml" />
</target>
<target
name="fetchEBuilderFromGit"
depends="init,fetchEBuilderLocal"
unless="EBuilderfetched">
<echo message="Fetching EBuilder from Git via CGit" />
<get
src="https://${gitHost}/c/platform/${scmProject}.git/snapshot/${scmProject}-${EBUILDER_HASH}.zip"
dest="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}.zip"
httpusecaches="false"
verbose="true" />
<unzip
src="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}.zip"
dest="${WORKSPACE}/tempEBuilder/"
overwrite="true" />
<echo message="preparing to move ${WORKSPACE}/tempEBuilder" />
<echo message=" into ${WORKSPACE}/${folderName}" />
<echo message=" using regexp mapper" />
<!-- We need only the 'production/testscripts' directory. And input can be of different "depths" depending on where it comes from. -->
<move
verbose="true"
todir="${WORKSPACE}/${folderName}">
<fileset dir="${WORKSPACE}/tempEBuilder" />
<mapper
type="regexp"
from=".*production([/\\])testScripts(.*)"
to="production\1testScripts\2" />
</move>
<echo message="Fetched EBuilder/production/testscrips to ${WORKSPACE}/${folderName}" />
<property
name="EBuilderfetched"
value="true" />
</target>
<!-- specify -DnoEBuildercleanup=true on command line, to have zip and folder left in place,
such as for debugging or desired to copy the zip to your local cache.
-->
<target
name="EBuildercleanup"
unless="noEBuildercleanup">
<!-- we've moved the files, now to remove the empty dir -->
<delete
dir="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}"
failonerror="false" />
<!-- cleanup (may eventually want to "cache" this zip file, so no need to re-fetch if already exists -->
<delete
file="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}.zip"
failonerror="false" />
<delete
dir="${WORKSPACE}/tempEBuilder"
failonerror="false" />
<echo message="Cleaned temporary working copies" />
</target>
<!-- Will leave here for now, though doesn't add much. We had two choices: local, git.
-->
<target
name="fetchEBuilder"
depends="init, fetchEBuilderFromGit"
unless="EBuilderfetched">
<fail message="EBuilder was not fetched by any available method. Is a local variable not set?" />
</target>
<target
name="fetchEBuilderLocal"
depends="init,fetchEBuilderDirect"
if="EBuilderlocal"
unless="EBuilderfetched">
<echo message="Fetching pre-made EBuilder subset from local machine." />
<unzip
src="${EBuilderlocal}/${scmProject}-${EBUILDER_HASH}.zip"
dest="${WORKSPACE}"
overwrite="true" />
<move
todir="${WORKSPACE}/${folderName}"
failonerror="true">
<fileset dir="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}">
<include name="**/*" />
</fileset>
</move>
<echo message="Copied EBuilder to ${WORKSPACE}/${folderName}" />
<property
name="EBuilderfetched"
value="true" />
</target>
<target
name="fetchEBuilderDirect"
depends="init"
if="downloadURL"
unless="EBuilderfetched">
<echo message="Fetching pre-made EBuilder subset from download site." />
<get
src="${downloadURL}/${scmProject}-${EBUILDER_HASH}.zip"
dest="${WORKSPACE}"
httpusecaches="false"
verbose="true" />
<available
file="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}.zip"
property="EzipExists" />
<antcall target="unzipDownloadedZip" />
<condition property="EBuilderfetched">
<available file="${WORKSPACE}/${folderName}/production" />
</condition>
</target>
<target
name="unzipDownloadedZip"
if="EzipExists">
<echo message="Fetched EBuilder from ${downloadURL}" />
<unzip
src="${WORKSPACE}/${scmProject}-${EBUILDER_HASH}.zip"
dest="${WORKSPACE}"
overwrite="true" />
<!-- Not sure this is needed, since 'folderName' and 'scmProject' are
the same. (At least, the defaults set in this script).
-->
<move todir="${WORKSPACE}/${folderName}">
<fileset dir="${WORKSPACE}/${scmProject}">
<include name="**/*" />
</fileset>
</move>
<echo message="Moved EBuilder (subset) to ${WORKSPACE}/${folderName}" />
</target>
<target
name="initWorkspace"
unless="WORKSPACE">
<property environment="env" />
<condition
property="WORKSPACE"
value="${env.WORKSPACE}"
else="${basedir}">
<isset property="env.WORKSPACE" />
</condition>
</target>
</project>