orfox / jenkins-build @ f5eeeb2f
History | View | Annotate | Download (2.28 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/orfox-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 |
# THIS VERSIONING CAN BE USED FOR ALPHA, ANOTHER TYPE CAN BE USED FOR BETA AND RELEASE |
59 |
cat $WORKSPACE/external/tor-browser/obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml | sed \ |
60 |
-e "s,android:versionCode=\"[0-9][0-9]*\",android:versionCode=\"$versionCodeDate\"," \ |
61 |
-e "s,android:versionName=\"\([^\"][^\"]*\)\",android:versionName=\"\1-esr-Orfox-0.0.1-$versionNameDate\"," \ |
62 |
> $WORKSPACE/external/tor-browser/tempManifest.xml |
63 |
mv $WORKSPACE/external/tor-browser/tempManifest.xml $WORKSPACE/external/tor-browser/obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml |
64 |
|
65 |
|
66 |
./mach package |
67 |
./mach build-backend -b AndroidEclipse |
68 |
|
69 |
#------------------------------------------------------------------------------# |
70 |
# run local tests |
71 |
cd $WORKSPACE/tests |
72 |
./run-tests.sh |
73 |
|
74 |
# only tell jenkins there was an error if we got ERROR or FATAL |
75 |
[ $(($? & 1)) = "1" ] && exit 1 |
76 |
[ $(($? & 2)) = "2" ] && exit 2 |
77 |
set -e |