blob: 8cb226aafa920af8168204b3d1cf27afd2019a4f (
plain)
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
|
#!/bin/bash
#*******************************************************************************
# Copyright (c) 2010, 2012 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# IBM Corporation - initial API and implementation
#*******************************************************************************
PATH=$PATH:/usr/local/bin
export PATH
#default values, overridden by command line
writableBuildRoot=/shared/eclipse/e4/orion
supportDir=$writableBuildRoot/support
builderDir=$supportDir/org.eclipse.orion.releng
basebuilderBranch=R3_8
publish=""
user=johna
resultsEmail=orion-releng@eclipse.org
buildType=I
date=$(date +%Y%m%d)
time=$(date +%H%M)
timestamp=$date$time
while [ $# -gt 0 ]
do
case "$1" in
"-I")
buildType=I;
tagMaps="-DtagMaps=true";
compareMaps="-DcompareMaps=true";;
"-N")
buildType=N;
tagMaps="";
compareMaps="";
fetchTag="-DfetchTag=CVS=HEAD,GIT=origin/master";;
"-baseBuilder")
baseBuilderBranch="$2"; shift;;
"-root")
writableBuildRoot="$2"; shift;;
"-support")
supportDir="$2"; shift;;
"-publish")
publish="-DpublishToEclipse=true";;
"-timestamp")
timestamp="$2";
date=${timestamp:0:8}
time=${timestamp:8};
shift;;
"-noTag")
noTag=true;;
"-hudson")
hudson=true;;
"-email")
resultsEmail="$2"; shift;;
-*)
echo >&2 usage: $0 [-I | -N]
exit 1;;
*) break;; # terminate while loop
esac
shift
done
setProperties () {
buildDirectory=$writableBuildRoot/$buildType$timestamp
buildLabel=$buildType$date-$time
javaHome=/shared/common/sun-jdk1.6.0_21_x64
pushd $supportDir
launcherJar=$supportDir/$( find org.eclipse.releng.basebuilder/ -name "org.eclipse.equinox.launcher_*.jar" | sort | head -1 )
popd
#Properties for compilation boot classpaths
JAVA60_HOME=/shared/common/jdk-1.6.0_10
JAVA50_HOME=/shared/common/jdk-1.5.0_16
JAVA14_HOME=/shared/common/j2sdk1.4.2_19
j2se142="$JAVA14_HOME/jre/lib/rt.jar:$JAVA14_HOME/jre/lib/jsse.jar:$JAVA14_HOME/jre/lib/jce.jar:$JAVA14_HOME/jre/lib/charsets.jar"
j2se150="$JAVA50_HOME/jre/lib/rt.jar:$JAVA50_HOME/jre/lib/jsse.jar:$JAVA50_HOME/jre/lib/jce.jar:$JAVA50_HOME/jre/lib/charsets.jar"
javase160="$JAVA60_HOME/jre/lib/resources.jar:$JAVA60_HOME/jre/lib/rt.jar:$JAVA60_HOME/jre/lib/jsse.jar:$JAVA60_HOME/jre/lib/jce.jar:$JAVA60_HOME/jre/lib/charsets.jar"
}
updateRelengProject () {
pushd $supportDir
if [[ -d org.eclipse.orion.releng ]]; then
rm -rf org.eclipse.orion.releng
fi
if [ "$buildType" == "N" -o -n "$noTag" ]; then
pushd $writableBuildRoot/gitClones/org.eclipse.orion.server
git pull
popd
fi
echo "[`date +%H\:%M\:%S`] Get org.eclipse.orion.releng"
cp -r $writableBuildRoot/gitClones/org.eclipse.orion.server/releng/org.eclipse.orion.releng .
echo "[`date +%H\:%M\:%S`] Done getting org.eclipse.orion.releng"
popd
}
updateBaseBuilder () {
pushd $supportDir
if [[ ! -d org.eclipse.releng.basebuilder_${basebuilderBranch} ]]; then
echo "[start - `date +%H\:%M\:%S`] Get org.eclipse.releng.basebuilder_${basebuilderBranch}"
cmd="cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse $quietCVS ex -r $basebuilderBranch -d org.eclipse.releng.basebuilder_${basebuilderBranch} org.eclipse.releng.basebuilder"
echo $cmd
$cmd
echo "[finish - `date +%H\:%M\:%S`] Done getting org.eclipse.releng.basebuilder_${basebuilderBranch}"
fi
echo "[`date +%H\:%M\:%S`] Getting org.eclipse.releng.basebuilder_${basebuilderBranch}"
rm org.eclipse.releng.basebuilder
ln -s ${supportDir}/org.eclipse.releng.basebuilder_${basebuilderBranch} org.eclipse.releng.basebuilder
echo "[`date +%H\:%M\:%S`] Done setting org.eclipse.releng.basebuilder"
popd
}
tagRepositories() {
#do this for I builds and if -noTag was not specified
if [ "$buildType" == "I" -a -z "$noTag" ]; then
pushd $writableBuildRoot/gitClones
if [ ! -f git-map.sh ]; then
wget -O git-map.sh http://dev.eclipse.org/viewcvs/viewvc.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-map.sh?view=co&content-type=text/plain
fi
if [ ! -f git-submission.sh ]; then
wget -O git-submission.sh http://dev.eclipse.org/viewcvs/viewvc.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-submission.sh?view=co&content-type=text/plain
fi
#pull the server first to get the latest map files before updating with new tags
cd $writableBuildRoot/gitClones/org.eclipse.orion.server
git pull
cd $writableBuildRoot/gitClones/org.eclipse.orion.client
git pull
cd $writableBuildRoot/gitClones
/bin/bash $writableBuildRoot/gitClones/git-map.sh \
$writableBuildRoot/gitClones \
$writableBuildRoot/gitClones/org.eclipse.orion.server/releng/org.eclipse.orion.releng \
git://git.eclipse.org/gitroot/orion/org.eclipse.orion.server.git \
git://git.eclipse.org/gitroot/orion/org.eclipse.orion.client.git > maps.txt
grep -v ^OK maps.txt | grep -v ^Executed >run.txt
/bin/bash run.txt
mkdir $writableBuildRoot/$buildType$timestamp
cp report.txt $writableBuildRoot/$buildType$timestamp
cd $writableBuildRoot/gitClones/org.eclipse.orion.server
git add releng/org.eclipse.orion.releng/maps/orion.map
git commit -m "Releng build tagging for $buildType$timestamp"
git tag -f $buildType$timestamp #tag the map file change
git push
git push --tags
popd
fi
}
runBuild () {
cmd="$javaHome/bin/java -enableassertions -jar $launcherJar \
-application org.eclipse.ant.core.antRunner \
-buildfile $builderDir/buildWebIDE.xml \
-Dbuilder=$builderDir/builder \
-Dbase=$writableBuildRoot \
-DbuildType=$buildType -Dtimestamp=$timestamp -DbuildLabel=$buildLabel \
-DgitUser=$user \
$tagMaps $compareMaps $fetchTag $publish \
-DJ2SE-1.4=$j2se142 \
-DJ2SE-1.5=$j2se150 \
-DJavaSE-1.6=$javase160"
echo "[`date +%H\:%M\:%S`] Launching Build"
$cmd
echo "[`date +%H\:%M\:%S`] Build Complete"
#stop now if the build failed
failure=$(sed -n '/BUILD FAILED/,/Total time/p' $writableBuildRoot/logs/current.log)
if [[ ! -z $failure ]]; then
compileMsg=""
prereqMsg=""
pushd $buildDirectory/plugins
compileProblems=$( find . -name compilation.problem | cut -d/ -f2 )
popd
if [[ ! -z $compileProblems ]]; then
compileMsg="Compile errors occurred in the following bundles:"
fi
if [[ -e $buildDirectory/prereqErrors.log ]]; then
prereqMsg=`cat $buildDirectory/prereqErrors.log`
fi
mailx -s "Orion Build : $buildLabel failed" $resultsEmail <<EOF
$compileMsg
$compileProblems
$prereqMsg
$failure
EOF
exit
fi
}
runTests () {
cmd="$javaHome/bin/java -jar $launcherJar \
-application org.eclipse.ant.core.antRunner \
-buildfile $builderDir/builder/scripts/runTests.xml \
-DbuildDirectory=$buildDirectory \
-Dbuilder=$builderDir/builder \
-Dbase=$writableBuildRoot \
-DbuildType=$buildType \
-Dtimestamp=$timestamp \
-DbuildLabel=$buildLabel \
$fetchTag \
-DJ2SE-1.4=$j2se142 \
-DJ2SE-1.5=$j2se150 \
-DJavaSE-1.6=$javase160"
echo "[`date +%H\:%M\:%S`] Starting Tests"
$cmd
echo "[`date +%H\:%M\:%S`] Ending Tests"
}
sendMail () {
compileMsg=""
prereqMsg=""
failed=""
tagMsg=`cat $buildDirectory/report.txt`
testsMsg=$(sed -n '/<!--START-TESTS-->/,/<!--END-TESTS-->/p' $buildDirectory/$buildLabel/drop/index.html > mail.txt)
testsMsg=$(cat mail.txt | sed s_href=\"_href=\"http://download.eclipse.org/orion/drops/$buildType$timestamp/_)
rm mail.txt
red=$(echo $testsMsg | grep "ff0000")
if [[ ! -z $red ]]; then
failed="tests failed"
fi
pushd $buildDirectory/plugins
compileProblems=$( find . -name compilation.problem | cut -d/ -f2 )
popd
if [[ ! -z $compileProblems ]]; then
failed="failed"
compileMsg="Compile errors occurred in the following bundles:"
fi
if [[ -e $buildDirectory/prereqErrors.log ]]; then
prereqMsg=`cat $buildDirectory/prereqErrors.log`
fi
echo "[`date +%H\:%M\:%S`] Sending mail to $resultsEmail"
(
echo "From: e4Build@build.eclipse.org "
echo "To: $resultsEmail "
echo "MIME-Version: 1.0 "
echo "Content-Type: text/html; charset=us-ascii"
echo "Subject: Orion Build : $buildLabel $failed"
echo ""
echo "<html><head><title>Orion Build $buildLabel</title></head>"
echo "<body>See here for the build results: <a href="http://download.eclipse.org/orion/drops/$buildType$timestamp">$buildLabel</a><br>"
echo "<pre>$tagMsg</pre><br>$testsMsg<br>$compileMsg<br>$compileProblems<br>$prereqMsg</body></html>"
) | /usr/lib/sendmail -t
}
publish () {
echo "[`date +%H\:%M\:%S`] Publishing to eclipse.org"
pushd $buildDirectory/$buildLabel
scp -r drop $user@build.eclipse.org:/home/data/httpd/download.eclipse.org/orion/drops/$buildType$timestamp
if [ $buildType = I ]; then
scp -r $buildDirectory/plugins/org.eclipse.orion.doc.isv/jsdoc $user@build.eclipse.org:/home/data/httpd/download.eclipse.org/orion
fi
rsync --recursive --delete $writableBuildRoot/target/integration $user@build.eclipse.org:/home/data/httpd/download.eclipse.org/orion/updates
}
cd $writableBuildRoot
#tag before updateRelengProject so that we get the new map files
tagRepositories
updateRelengProject
updateBaseBuilder
setProperties
runBuild
#for now, no tests or publishing when running hudson
if [ -z "$hudson" ]; then
runTests
publish
fi
sendMail
|