orfox / jenkins-build @ df3bb20c
History | View | Annotate | Download (1.98 KB)
1 |
#!/bin/sh |
---|---|
2 |
# |
3 |
# this is the script run by the Jenkins server to run the build and tests. Be |
4 |
# sure to always run it in its dir, i.e. ./run-tests.sh, otherwise it might |
5 |
# remove things that you don't want it to. |
6 |
|
7 |
#if [ `dirname $0` != "." ]; then |
8 |
# echo "only run this script like ./`basename $0`" |
9 |
# exit |
10 |
#fi |
11 |
|
12 |
set -e |
13 |
set -x |
14 |
|
15 |
if [ -z $WORKSPACE ]; then |
16 |
WORKSPACE=`pwd` |
17 |
fi |
18 |
|
19 |
if [ -z $ANDROID_HOME ]; then |
20 |
if [ -e ~/.android/bashrc ]; then |
21 |
. ~/.android/bashrc |
22 |
else |
23 |
echo "ANDROID_HOME must be set!" |
24 |
exit |
25 |
fi |
26 |
fi |
27 |
|
28 |
if [ -z $ANDROID_NDK_HOME ]; then |
29 |
if which ndk-build 2>&1 /dev/null; then |
30 |
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'` |
31 |
else |
32 |
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH" |
33 |
exit |
34 |
fi |
35 |
fi |
36 |
|
37 |
# use ndk-r8e |
38 |
export NDK_BASE=$NDK_BASE"-r8e" |
39 |
|
40 |
# set the mozconfig to be used |
41 |
cd $WORKSPACE |
42 |
export MOZCONFIG="$WORKSPACE/external/tor-browser/.mozconfig-android" |
43 |
|
44 |
# switch to gecko dev and build |
45 |
cd external/tor-browser |
46 |
./mach configure |
47 |
./mach build |
48 |
|
49 |
# Need to add in add-ons before the package step |
50 |
mkdir -p obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/ |
51 |
cp -r $WORKSPACE/external/addons/* obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/ |
52 |
|
53 |
|
54 |
# reset version code/name to current date |
55 |
versionCodeDate=`date +%s` |
56 |
versionNameDate=`date +%Y-%m-%d_%H.%M.%S` |
57 |
|
58 |
cat $WORKSPACE/external/tor-browser/obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml | sed \ |
59 |
-e "s,android:versionCode=\"[0-9][0-9]*\",android:versionCode=\"$versionCodeDate\"," \ |
60 |
-e "s,android:versionName=\"\([^\"][^\"]*\)\",android:versionName=\"\1.$versionNameDate\"," \ |
61 |
> /dev/null |
62 |
|
63 |
|
64 |
./mach package |
65 |
./mach build-backend -b AndroidEclipse |
66 |
|
67 |
#------------------------------------------------------------------------------# |
68 |
# run local tests |
69 |
cd $WORKSPACE/tests |
70 |
./run-tests.sh |
71 |
|
72 |
# only tell jenkins there was an error if we got ERROR or FATAL |
73 |
[ $(($? & 1)) = "1" ] && exit 1 |
74 |
[ $(($? & 2)) = "2" ] && exit 2 |
75 |
set -e |