diff --git a/.gitignore b/.gitignore
index d7c37e410..2936b6785 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,13 @@
-local.properties
-bin
-gen
.settings
+bin
+coverage
+coverage.ec
+coverage.em
+gen
+javadoc
+junit-report.xml
+lint-results.*ml
+lint-results_files
+local.properties
+monkey.txt
*~
diff --git a/build.xml b/build.xml
index fa7023472..f844364e9 100644
--- a/build.xml
+++ b/build.xml
@@ -82,11 +82,11 @@
-
+
-
+
@@ -95,14 +95,14 @@
Building version number ${version-name}
-
+
Building version number ${version-name}
-
+
Setting version to ${version-name}
You can't set the version without passing -Dversion-name=1.234
@@ -113,12 +113,12 @@
-
+
Bumping K-9 to ${version-name}
-
+
@@ -159,51 +159,30 @@
-
-
-
- Installing ${out.final.file} onto default emulator...
-
-
-
-
-
-
-
- Reinstalling ${out.final.file} onto default emulator...
-
-
-
-
-
-
+
-
+
+
- Android Ant Build. Available targets:
- help: Displays this help.
- debug: Builds the application and sign it with a debug key.
- release: Builds the application. The generated apk file must be
- signed before it is published.
- install: Installs the debug package onto a running emulator or
- device. This can only be used if the application has
- not yet been installed.
- reinstall: Installs the debug package on a running emulator or
- device that already has the application.
- The signatures must match.
- uninstall: uninstall the application from a running emulator or
- device.
- bump-version: ant -Dversion-name=3.123
- Bumps the project version to 3.123,tags and commits it
- astyle: Make K-9's source look like it's supposed to
- eclipse: Apply template Eclipse settings
- javadoc: Create javadoc. Requires ANDROID_HOME environment
- variable to be set (i.e. /opt/android-sdk-update-manager/)
+ Additional targets:
+
+ rclib: Creates library for remote control applications.
+ astyle: Make K-9's source look like it's supposed to.
+ eclipse: Apply template Eclipse settings.
+ javadoc: Javadoc output to javadoc/. ANDROID_HOME environment
+ variable must be set (i.e. /opt/android-sdk-linux/).
+ lint-xml: Lint output lint-results.xml.
+ lint-html: Lint output to lint-results.html.
+ monkey: Runs monkey on the running emulator. Change the
+ defaults -Dmonkey.seed=NUM and -Dmonkey.count=NUM
+ from 0 and 200, respectively.
@@ -213,19 +192,110 @@
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index fccd76e41..32467d6ba 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -13,7 +13,7 @@
-
-
-
- Downloading XML test report...
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WARNING: Code Coverage is currently only supported on the emulator and rooted devices.
+
+
+
+
+
+
+
+ Downloading coverage file into project directory...
+
+
+
+
+
+
+ Extracting coverage report...
+
+
+
+
+
+
+
+
+
+
+
+
+ Saving the report file in ${basedir}/coverage/coverage.html
+
+
+
+
+
+
+ Saving the JUnit test report as ${junit-file}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Additional targets:
+ javadoc: Javadoc output to javadoc/. ANDROID_HOME environment
+ variable must be set (i.e. /opt/android-sdk-linux/).
+ lint-xml: Lint output lint-results.xml.
+ lint-html: Lint output to lint-results.html.
+ test: Overridden -- also outputs junit-report.xml.
+ artifacts: Copies the apks as unique CloudBees artifacts. Usage:
+ ant [emma] [debug] artifacts
+
+
+
+
diff --git a/tests/clean-tests.sh b/tests/clean-tests.sh
new file mode 100755
index 000000000..1995ed911
--- /dev/null
+++ b/tests/clean-tests.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# clean and run all the tests on an emulator -- only one emulator should be running (a device can be attached).
+# will start and stop an emulator if no emulator is running.
+# name of emulator is given as an argument (no spaces in the name!), or "api7" if not given.
+# starting the emulator requires daemonize which requires a Unix-like system: http://software.clapper.org/daemonize/
+
+# clean
+ant all clean || exit 99
+
+# see if emulator is running, and uninstall package if so
+EMULATOR_ALREADY_RUNNING=false
+if adb devices | grep emulator | grep device$; then
+ ant -Dadb.device.arg=-e uninstall || exit 98
+ EMULATOR_ALREADY_RUNNING=true
+fi
+
+# build project and test project
+time ant emma debug artifacts || exit 1
+
+# start emulator if not running, and uninstall package
+if [ $EMULATOR_ALREADY_RUNNING == false ] ; then
+ if [ -z $1 ]; then
+ AVD_NAME=api7
+ else
+ AVD_NAME=$1
+ fi
+
+ echo starting emulator ${AVD_NAME}
+ daemonize -o /tmp/${AVD_NAME}.stdout -e /tmp/${AVD_NAME}.stderr -p /tmp/${AVD_NAME}.pid -l /tmp/${AVD_NAME}.lock \
+ $ANDROID_HOME/tools/emulator-arm -avd ${AVD_NAME} -no-audio -no-window -no-snapshot-save || exit 97
+ ps ux | grep -f /tmp/${AVD_NAME}.pid | grep emulator || exit 96
+ adb kill-server
+ time adb start-server
+ adb devices
+ #sleep 7
+ adb devices | grep emulator || exit 95
+ echo adb -e wait-for-device
+ time adb -e wait-for-device
+ adb devices | grep device$ || exit 94
+ ant -Dadb.device.arg=-e uninstall || exit 98
+fi
+
+# install project and test project, run tests
+time ant -Dadb.device.arg=-e emma installd test || exit 2
+
+# lint, javadoc, monkey
+cd ..
+time ant lint-xml || exit 3
+time ant javadoc || exit 4
+time ant -Dmonkey.count=200 -Dmonkey.seed=0 monkey || exit 5
+
+# kill emulator if this script started it
+if [ $EMULATOR_ALREADY_RUNNING == false ] ; then
+ adb emu kill || exit 93
+ sleep 1
+ ! ps ux | grep -f /tmp/${AVD_NAME}.pid | grep emulator || exit 92
+ rm -f /tmp/${AVD_NAME}.stdout /tmp/${AVD_NAME}.stderr /tmp/${AVD_NAME}.pid /tmp/${AVD_NAME}.lock
+fi