blob: c296c928436c0b419f3600a6f740f40d7db415a0 [file] [log] [blame]
#!/bin/bash
# Utility script for compiling and testing the app.
#
# Must be called from the top of compile tree.
#
# Example to build and install:
#
# $ makepp bi
#
# For a full list of options run without arguments.
#
while [[ $PWD != "/" ]]; do
if [[ -d ".repo" ]]; then
break
else
cd ..
fi
done
if [[ ! -d ".repo" ]]; then
echo "Must execute this script in checked-out repo tree" >&2
exit 1
fi
echo "Running in ${PWD}"
. build/envsetup.sh;
if [[ $# == 0 ]]; then
echo "usage: makepp [b] [i] [t] [T] [u] [m] [c]" >&2
echo " b = build" >&2
echo " i = adb install" >&2
echo " t = test" >&2
echo " T = uninstall tests" >&2
echo " u = adb uninstall (before install)" >&2
echo " m = make dependencies" >&2
echo " c = clean" >&2
exit 0
fi
build=
install=
uninstall=
runtests=
uninstall_tests=
make_dependencies=
clean=
# Explode the command line params in case they are all jammed together in
# one parameter.
[[ $* =~ c ]] && clean=1 && echo Clean
[[ $* =~ m ]] && make_dependencies=1 && echo Making dependencies
[[ $* =~ b ]] && build=1 && echo Building
[[ $* =~ u ]] && uninstall=1 && echo Uninstalling
[[ $* =~ T ]] && uninstall_tests=1 && echo Uninstall Tests
[[ $* =~ i ]] && install=1 && echo Installing
[[ $* =~ t ]] && runtests=1 && echo Testing
set -e
[[ -n "$clean" ]] && bash -xc "
rm -rf out/target/common/obj/APPS/PixelPerfect*;
rm -rf out/target/common/obj/JAVA_LIBRARIES/*pixelperfect*
rm -rf out/target/product/*/data/app/PixelPerfect*"
[[ -n "$make_dependencies" ]] && mmm external/protobuf:libprotobuf-java-2.3.0-lite &&
mmma vendor/unbundled_google/packages/PrebuiltGmsCore &&
make mockito-target &&
make android-support-test
[[ -n "$build" ]] && mmm packages/experimental/PixelPerfect
[[ -n "$uninstall" ]] && bash -xc "adb uninstall com.google.android.apps.pixelperfect.platform"
[[ -n "$uninstall_tests" ]] && bash -xc "adb uninstall com.google.android.apps.pixelperfect.platform.tests"
[[ -n "$install" ]] && bash -xc "adb install -r out/target/product/generic/system/app/PixelPerfectPlatform.apk"
[[ -n "$runtests" ]] && runtest --path packages/experimental/PixelPerfect