Drive all levels through UI instrumentation
This commit is contained in:
@@ -36,6 +36,7 @@ ANDROID_NDK_DIR="$SDK_DIR/ndk/27.2.12479018"
|
||||
ANDROID_CMAKE_DIR="$SDK_DIR/cmake/3.22.1"
|
||||
ANDROID_TOOLBIN="$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
STATE_TTL_SECONDS=86400
|
||||
HIDE_EMULATOR_WINDOW="false"
|
||||
|
||||
log() {
|
||||
printf '\n[%s] %s\n' "tooling" "$1"
|
||||
@@ -642,11 +643,16 @@ start_emulator_if_needed() {
|
||||
fi
|
||||
|
||||
local emulator_log="$PROJECT_DIR/build/reports/android-emulator.log"
|
||||
local emulator_window_args=()
|
||||
if [ "$HIDE_EMULATOR_WINDOW" = "true" ]; then
|
||||
emulator_window_args=(-no-window)
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$emulator_log")"
|
||||
log "Starting Android emulator: $ANDROID_TEST_AVD_NAME"
|
||||
"$SDK_DIR/emulator/emulator" \
|
||||
-avd "$ANDROID_TEST_AVD_NAME" \
|
||||
-no-window \
|
||||
"${emulator_window_args[@]}" \
|
||||
-no-audio \
|
||||
-no-boot-anim \
|
||||
-gpu swiftshader_indirect \
|
||||
@@ -788,31 +794,54 @@ maybe_run_operation() {
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF_USAGE
|
||||
Usage: bash ./AndroidProjectTooling.sh [--build | --build-release-aab | --test | --clean-test | --test-emulator | --compile-git]
|
||||
Usage: bash ./AndroidProjectTooling.sh [--build | --build-release-aab | --test | --clean-test | --test-emulator [--hide-emulator-window] | --compile-git]
|
||||
|
||||
--build Set up the environment and build the debug APK
|
||||
--build-release-aab Set up the environment and build a release Android App Bundle (AAB)
|
||||
--test Set up the environment, compile host Git, and run the debug JVM unit tests with it
|
||||
--clean-test Set up the environment, clean Gradle outputs, and run the debug JVM unit tests
|
||||
--test-emulator Set up an Android emulator and run debug instrumentation tests on it
|
||||
--test-emulator Set up a visible Android emulator and run debug instrumentation tests on it
|
||||
--hide-emulator-window Run --test-emulator with the emulator window hidden
|
||||
--compile-git Compile Git for the development host and all Android target ABIs
|
||||
EOF_USAGE
|
||||
}
|
||||
|
||||
validate_args() {
|
||||
case "${1:-}" in
|
||||
local mode="${1:-}"
|
||||
shift || true
|
||||
|
||||
case "$mode" in
|
||||
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
echo "Unknown argument: $mode" >&2
|
||||
print_usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--hide-emulator-window)
|
||||
if [ "$mode" != "--test-emulator" ]; then
|
||||
echo "--hide-emulator-window can only be used with --test-emulator" >&2
|
||||
print_usage >&2
|
||||
exit 1
|
||||
fi
|
||||
HIDE_EMULATOR_WINDOW="true"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
print_usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
validate_args "${1:-}"
|
||||
validate_args "$@"
|
||||
|
||||
require_tool curl
|
||||
require_tool unzip
|
||||
|
||||
Reference in New Issue
Block a user