Statistics
| Branch: | Tag: | Revision:

orfox / jenkins-build @ 3147c3d3

History | View | Annotate | Download (1.74 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
./mach package
49
./mach build-backend -b AndroidEclipse
50

    
51
# reset version code/name to current date
52
versionCodeDate=`date +%s`
53
versionNameDate=`date +%Y-%m-%d_%H.%M.%S`
54

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

    
60
#------------------------------------------------------------------------------#
61
# run local tests
62
cd $WORKSPACE/tests
63
./run-tests.sh
64

    
65
# only tell jenkins there was an error if we got ERROR or FATAL
66
[ $(($? & 1)) = "1" ] && exit 1
67
[ $(($? & 2)) = "2" ] && exit 2
68
set -e