Statistics
| Branch: | Tag: | Revision:

orfox / jenkins-build @ c6f52b5d

History | View | Annotate | Download (1.92 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-*/dist/bin/distribution/extensions/
51
cp -r $WORKSPACE/external/addons/* obj-tbb*/dist/bin/distribution/extensions/
52

    
53
./mach package
54
./mach build-backend -b AndroidEclipse
55

    
56
# reset version code/name to current date
57
versionCodeDate=`date +%s`
58
versionNameDate=`date +%Y-%m-%d_%H.%M.%S`
59

    
60
cat $WORKSPACE/external/tor-browser/obj-tbb-*/mobile/android/base/AndroidManifest.xml | sed \
61
    -e "s,android:versionCode=\"[0-9][0-9]*\",android:versionCode=\"$versionCodeDate\"," \
62
    -e "s,android:versionName=\"\([^\"][^\"]*\)\",android:versionName=\"\1.$versionNameDate\"," \
63
    > /dev/null
64

    
65
#------------------------------------------------------------------------------#
66
# run local tests
67
cd $WORKSPACE/tests
68
./run-tests.sh
69

    
70
# only tell jenkins there was an error if we got ERROR or FATAL
71
[ $(($? & 1)) = "1" ] && exit 1
72
[ $(($? & 2)) = "2" ] && exit 2
73
set -e