-
Notifications
You must be signed in to change notification settings - Fork 41
/
jenkins-build
executable file
·80 lines (64 loc) · 2.41 KB
/
jenkins-build
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
#!/bin/sh
#
# this is the script run by the Jenkins server to run the build and tests. Be
# sure to always run it in its dir, i.e. ./run-tests.sh, otherwise it might
# remove things that you don't want it to.
if [ `dirname $0` != "." ]; then
echo "only run this script like ./`basename $0`"
exit
fi
if [ -z $WORKSPACE ]; then
WORKSPACE=`pwd`
fi
if [ -z $ANDROID_HOME ]; then
if [ -e ~/.android/bashrc ]; then
. ~/.android/bashrc
else
echo "ANDROID_HOME must be set!"
exit
fi
fi
if [ -z $ANDROID_NDK_HOME ]; then
if which ndk-build 2>&1 /dev/null; then
ANDROID_NDK_HOME=`which ndk-build | sed 's,/ndk-build,,'`
else
echo "ANDROID_NDK_HOME not set and 'ndk-build' not in PATH"
exit
fi
fi
export NDK_BASE=${ANDROID_NDK_HOME}-r8e
if [ ! -e $NDK_BASE ]; then
echo "Mozilla requires the use of Android NDK r8e only"
echo "This script expects it at $NDK_BASE"
exit 1
fi
set -e
set -x
# standardize timezone to reduce build differences
export TZ=UTC
# set the mozconfig to be used
cd $WORKSPACE
export MOZCONFIG="$WORKSPACE/external/tor-browser/.mozconfig-orfox"
# switch to gecko dev and build
cd external/tor-browser
./mach configure
./mach build
# Need to add in add-ons before the package step
mkdir -p obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/
cp -r $WORKSPACE/external/orfox-addons/* obj-tbb-arm-linux-androideabi/dist/bin/distribution/extensions/
# reset version code/name to current date
versionCodeDate=`date '+%s'`
versionNameDate=`date +%Y-%m-%d_%H.%M.%S`
# THIS VERSIONING CAN BE USED FOR ALPHA, ANOTHER TYPE CAN BE USED FOR BETA AND RELEASE
cat $WORKSPACE/external/tor-browser/obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml | sed \
-e "s,android:versionCode=\"[0-9][0-9]*\",android:versionCode=\"$versionCodeDate\"," \
-e "s,android:versionName=\"\([^\"][^\"]*\)\",android:versionName=\"\1-esr-Orfox-0.0.1-$versionNameDate\"," \
-e "s,android:debuggable=\"true\",android:debuggable=\"false\"," \
> $WORKSPACE/external/tor-browser/tempManifest.xml
mv $WORKSPACE/external/tor-browser/tempManifest.xml $WORKSPACE/external/tor-browser/obj-tbb-arm-linux-androideabi/mobile/android/base/AndroidManifest.xml
./mach package
./mach build-backend -b AndroidEclipse
#------------------------------------------------------------------------------#
# run local tests
cd $WORKSPACE/tests
./run-tests.sh