summaryrefslogtreecommitdiffstats
path: root/android-proj.sh
blob: 526725a1e186268ed8bcb49bcb8c89fcac924c4a (plain)
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
#! /bin/bash

if [ $# -lt 5 ]; then
    echo "usage $0 ProjPath PackageName ProjName ActivityName TargetID"
    exit 1
fi

PPATH=$1
PKG=$2
PNAME=$3
ANAME=$4
TARGET=$5

RESET="\033[0m"
RED="\033[0;31m"
BROWN="\033[0;33m"

function run ()
{
    echo -e "${RED}* ${BROWN}${1} ${RESET}"
    $1 || exit 1
}

run "android create project --path ${PPATH} --target ${TARGET} --package ${PKG} --name ${PNAME} --activity ${ANAME}"
run "android create test-project --path ${PPATH}/tests --name ${PNAME}Test --main ../"

run "cd $PPATH"
run "ant instrument"
run "ant instrument install"
#run "adb -s emulator-5554 install -r bin/${PNAME}-instrumented.apk"

run "cd tests"
run "ant instrument"
run "ant instrument install"
#run "adb -s emulator-5554 install -r bin/${PNAME}Test-instrumented.apk"

run "adb shell am instrument -e coverage true -w ${PKG}.tests/android.test.InstrumentationTestRunner"

run "adb shell pm uninstall ${PKG}"
run "adb shell pm uninstall ${PKG}.tests"