File: buildSDKSource.sh

package info (click to toggle)
eclipse 3.8.1-10
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 338,840 kB
  • ctags: 472,808
  • sloc: java: 2,762,042; ansic: 136,783; xml: 105,676; cpp: 35,759; jsp: 4,420; sh: 3,288; perl: 1,687; makefile: 232; python: 67; php: 24
file content (327 lines) | stat: -rwxr-xr-x 9,802 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
set -e

baseDir=$(pwd)
workDirectory=
baseBuilder=
eclipseBuilder=

buildID="I20120320-1400"
baseBuilderTag="R4_2_primary"
eclipseBuilderTag="R4_2_primary"
label="3.8.0-I20120320-1400"
fetchTests="yes"

usage="usage:  <build ID> [-workdir <working directory>] [-baseBuilder <path to org.eclipse.releng.basebuilder checkout>] [-eclipseBuilder <path to org.eclipse.releng.eclipsebuilder checkout>] [-baseBuilderTag <org.eclipse.releng.basebuilder tag to check out>] [-noTests]"

while [ $# -gt 0 ]
do
        case "$1" in
                -workdir) workDirectory="$2"; shift;;
                -workDir) workDirectory="$2"; shift;;
                -baseBuilder) baseBuilder="$2"; shift;;
                -baseBuilderTag) baseBuilderTag="$2"; shift;;
                -eclipseBuilder) eclipseBuilder="$2"; shift;;
                -eclipseBuilderTag) eclipseBuilderTag="$2"; shift;;
                -noTests) fetchTests="no"; shift;;
                -help) echo $usage; exit 0;;
                --help) echo $usage; exit 0;;
                -h) echo $usage; exit 0;;
                *) buildID="$1";
        esac
        shift
done

# Must specify a build ID
if [ "x${buildID}x" = "xx" ]; then
    echo >&2 "Must specify build ID.  Example:  R3_5_1 ."
    echo >&2 "${usage}"
    exit 1
else
  echo "Going to create source tarballs for ${buildID}."
fi

if [ "x${workDirectory}x" = "xx" ]; then
  workDirectory="${baseDir}"
  echo "Working directory not set; using this directory (${baseDir})."
fi

if [ "x${baseBuilder}x" = "xx" ]; then
  baseBuilder="${workDirectory}"/org.eclipse.releng.basebuilder
  echo "Basebuilder checkout not specified; will check out ${baseBuilderTag} into ${baseBuilder}."
fi
if [ "x${eclipseBuilder}x" = "xx" ]; then
  eclipseBuilder="${workDirectory}"/org.eclipse.releng.eclipsebuilder
  echo "Eclipsebuilder checkout not specified; will check out into ${eclipseBuilder}."
fi
if [ "x${eclipseBuilderTag}x" = "xx" ]; then
  eclipseBuilderTag="v${buildID}"
fi

fetchDirectory="${workDirectory}"/fetch
mkdir -p "${fetchDirectory}"
homeDirectory="${workDirectory}"/userhome
rm -rf "${homeDirectory}"
mkdir -p "${homeDirectory}"
workspace="${workDirectory}"/workspace
rm -rf "${workspace}"
mkdir -p "${workspace}"
cvsRepo=":pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse"
mapsRoot="org.eclipse.releng/maps"

# Fetch basebuilder
if [ ! -e "${baseBuilder}" ]; then
  mkdir -p "${baseBuilder}"
  cd "${baseBuilder}"/..
  cvs -d${cvsRepo} co -r ${baseBuilderTag} org.eclipse.releng.basebuilder
  cd "${baseDir}"
fi

# Fetch eclipsebuilder
if [ ! -e ${eclipseBuilder} ]; then
  mkdir -p "${eclipseBuilder}"
  cd "${eclipseBuilder}"/..
  cvs -d${cvsRepo} co -r ${eclipseBuilderTag} org.eclipse.releng.eclipsebuilder
  cd "${eclipseBuilder}"
  patch -p0 < "${baseDir}"/patches/eclipse-addFetchMasterAndTestsTargets.patch
  patch -p0 < "${baseDir}"/patches/eclipse-removeSkipMapsCheck.patch
  cd "${baseDir}"
fi

if [ -e ${fetchDirectory}/orbitRepo ]; then
  cd "${eclipseBuilder}"
  patch -p0 < "${baseDir}"/patches/eclipse-dontusefullmoonformaster.patch
  cd "${baseDir}"
fi

if [ -e ${fetchDirectory}/ecfBundles ]; then
  cd "${eclipseBuilder}"
  patch -p0 < "${baseDir}"/patches/eclipse-useLocalECFBundles.patch
  cd "${baseDir}"
fi

# Build must be run from within o.e.r.eclipsebuilder checkout
cd "${eclipseBuilder}"

java -jar \
"${baseBuilder}"/plugins/org.eclipse.equinox.launcher_*.jar \
-consolelog \
-data "${workspace}" \
-application org.eclipse.ant.core.antRunner \
-f buildAll.xml \
fetchMasterFeature \
-DbuildDirectory="${fetchDirectory}" \
-DskipBase=true \
-DmapsRepo=${cvsRepo} \
-DmapCvsRoot=${cvsRepo} \
-DmapsCvsRoot=${cvsRepo} \
-DmapsRoot=${mapsRoot} \
-DmapsCheckoutTag=${buildID} \
-DmapVersionTag=${buildID} \
-Duser.home="${homeDirectory}" \
2>&1 | tee ${workDirectory}/sourcesFetch.log

cd "${fetchDirectory}"

# Extract osgi.util src for rebuilding
pushd plugins/org.eclipse.osgi.util
  if [ -e src.zip ]; then
    unzip -q -d src src.zip
    # Remove pre-compiled class files and the source.zip
    rm -r org/ src.zip
  fi
popd

# Extract osgi.services src for rebuilding
pushd plugins/org.eclipse.osgi.services
  if [ -e src.zip ]; then
    unzip -q -d src src.zip
    # Remove pre-compiled class files and the source.zip
    rm -r org/ src.zip
  fi
popd

# Remove sources for service.io
pushd plugins
  rm -rf org.eclipse.equinox.io
  rm -rf org.eclipse.osgi.services/src/org/osgi/service/io/
popd

# Remove scmCache directory
rm -rf scmCache

#fetch and prepare ecf
git clone git://git.eclipse.org/gitroot/ecf/org.eclipse.ecf.git
cd org.eclipse.ecf
git archive --format=tar --prefix=ecf-3.5.5/ R-Release_HEAD-sdk_feature-51_2012-03-19_06-12-11 | gzip >ecf-3.5.5.tar.gz
cp ecf-3.5.5.tar.gz ../
cd ..
rm -fr org.eclipse.ecf
tar -xf ecf-3.5.5.tar.gz
rm -fr ecf-3.5.5.tar.gz
cd ecf-3.5.5

# Source for ECF bthat aren't part of SDK map files
for f in \
    org.eclipse.ecf \
    org.eclipse.ecf.filetransfer \
    org.eclipse.ecf.identity \
    org.eclipse.ecf.ssl \
; do
cp -rf framework/bundles/$f ../plugins;
rm -rf framework/bundles/$f
done

for f in \
    org.eclipse.ecf.provider.filetransfer \
    org.eclipse.ecf.provider.filetransfer.httpclient \
    org.eclipse.ecf.provider.filetransfer.httpclient.ssl \
    org.eclipse.ecf.provider.filetransfer.ssl \
; do
cp -rf  providers/bundles/$f ../plugins;
rm -rf providers/bundles/$f
done
cd ..
rm -fr ecf-3.5.5

#fix paths here - they are not correctly rendered
#fetch and prepare initializer
#rm -rf rt.equinox.incubator
git clone git://git.eclipse.org/gitroot/equinox/rt.equinox.incubator.git
cd rt.equinox.incubator
git archive --format=tar --prefix=org.eclipse.equinox.initializer/ HEAD:framework/bundles/org.eclipse.equinox.initializer | gzip > org.eclipse.equinox.initializer.tar.gz
cp org.eclipse.equinox.initializer.tar.gz ../
cd ..
rm -rf rt.equinox.incubator
tar -xf org.eclipse.equinox.initializer.tar.gz
rm -rf org.eclipse.equinox.initializer.tar.gz
cp -rf org.eclipse.equinox.initializer plugins
rm -rf org.eclipse.equinox.initializer

cd "${fetchDirectory}"
# We don't want to re-ship these as those bundles inside will already be
# copied into the right places for the build
rm -rf ecfBundles orbitRepo

# Remove files from the version control system
find -depth \( -name CVS -o -name .cvsignore \) -exec rm -rf {} \;

# Remove prebuilt binaries
find \( -name '*.exe' -o -name '*.dll' \) -delete
find -type f \( -name '*.so' -o -name '*.so.2' -o -name '*.a' \) -delete
find \( -name '*.sl' -o -name '*.jnilib' \) -delete
find features/org.eclipse.equinox.executable -name eclipse -delete
find -name '*.xpt' -delete

# Remove unnecessary repo
rm -rf tempSite
# Before removing all binary JARs extract source code
# of execution profiles to build them later
pushd plugins/org.eclipse.osgi/osgi
for f in \
        ee.foundation \
        ee.minimum-1.2.0 \
        ee.minimum \
        osgi.cmpn \
        osgi.core \
; do
	mkdir -p  ../../../environments/$f/
	mkdir -p $f
	cp "$f.jar" $f/
	cd $f
	jar xf "$f.jar" || unzip "$f.jar"
	cp -rf OSGI-OPT/src/ ../../../../environments/$f/ || echo "Copying $f failed"
	cp -rf META-INF ../../../../environments/$f/ || echo "Copying $f META-INF failed"
	cp -rf LICENSE ../../../../environments/$f/ || echo "Copying $f LICENCE failed"
	cp -rf about.html ../../../../environments/$f/ || echo "Copying $f about.html failed"
	cd ..
done;
popd

# Remove fetch logs
rm fetch_*

# Remove unnecessary feature and plugins
rm -rf features/org.eclipse.sdk.examples
rm -rf plugins/*.examples*

# Remove temporary files
find -name '*.orig' -delete

# Remove binary JARs
find -type f -name '*.jar' -delete
find -name '*.class' -delete

# Extract source .zip files
cd plugins/org.eclipse.osgi.services
unzip src.zip -d src
cd ../org.eclipse.osgi.util
unzip src.zip -d src
cd ../..
# Remove zip files
find -name '*.zip' -delete

# Correct permissions
find -type d -print0 | xargs -0 chmod 755
find -type f -print0 | xargs -0 chmod 644
find -type f -name '*.sh' -print0 | xargs -0 chmod 755

# Remove empty directories
find -type d -empty -delete

cd ..
#mv -f fetch eclipse-${label}-src
cp -rf fetch eclipse-${label}-src
rm -rf fetch
tar cjf "${workDirectory}"/eclipse-${label}-src.tar.bz2 \
  eclipse-${label}-src
cd "${eclipseBuilder}"

if [ "${fetchTests}" = "yes" ]; then

rm -rf "${fetchDirectory}"/*

java -jar \
"${baseBuilder}"/plugins/org.eclipse.equinox.launcher_*.jar \
-consolelog \
-data "${workspace}" \
-application org.eclipse.ant.core.antRunner \
-f buildAll.xml \
fetchSdkTestsFeature \
-DbuildDirectory="${fetchDirectory}" \
-DskipBase=true \
-Dhuson=true \
-DmapsRepo=${cvsRepo} \
-DmapCvsRoot=${cvsRepo} \
-DmapsCvsRoot=${cvsRepo} \
-DmapsRoot=${mapsRoot} \
-DmapsCheckoutTag=${buildID} \
-DmapVersionTag=${buildID} \
-Duser.home="${homeDirectory}" \
2>&1 | tee "${workDirectory}"/testsFetch.log

cd ${workDirectory}
mkdir -p ${workDirectory}/eclipse-sdktests-${label}-src
cp -rf ${fetchDirectory}/* ${workDirectory}/eclipse-sdktests-${label}-src
rm -rf ${fetchDirectory}/*
tar cjf ${workDirectory}/eclipse-sdktests-${label}-src.tar.bz2 \
 eclipse-sdktests-${label}-src

scriptsDir=org.eclipse.releng.eclipsebuilder/eclipse/buildConfigs/sdk.tests/testScripts
testScripts=eclipse-sdktests-${label}-scripts

# Testing runtests and test.xml scripts which are not in org.eclipse.test
rm -rf org.eclipse.releng.eclipsebuilder/eclipse/buildConfigs/sdk.tests/testScripts/*
cvs -d ${cvsRepo} co -r ${buildID} ${scriptsDir}

mkdir -p ${testScripts}
cp -rf ${scriptsDir}/runtests ${testScripts}
rm -rf ${scriptsDir}/runtests
cp -rf ${scriptsDir}/test.xml ${testScripts}
rm -rf ${scriptsDir}/test.xml
rm -rf org.eclipse.releng.eclipsebuilder
tar cjf ${workDirectory}/eclipse-sdktests-${label}-scripts.tar.bz2 ${testScripts}

fi

cd "${baseDir}"