Speed up runtime state refresh

This commit is contained in:
Joe Tretter
2026-06-24 17:44:53 -05:00
parent 0554c736e4
commit 1c15297ae6
7 changed files with 180 additions and 22 deletions

View File

@@ -679,6 +679,7 @@ maybe_run_operation() {
local should_compile_android_git="false"
local should_bundle_manpages="false"
local should_run_emulator="false"
local should_clean_gradle="false"
case "$mode" in
--build)
@@ -706,6 +707,12 @@ maybe_run_operation() {
artifact_label="debug unit tests"
should_compile_host_git="true"
;;
--clean-test)
gradle_task="testDebugUnitTest"
artifact_label="clean debug unit tests"
should_compile_host_git="true"
should_clean_gradle="true"
;;
--test-emulator)
gradle_task="connectedDebugAndroidTest"
artifact_label="debug instrumentation tests on Android emulator"
@@ -755,7 +762,11 @@ maybe_run_operation() {
fi
log "Running $artifact_label with --no-daemon"
"$PROJECT_DIR/gradlew" --no-daemon "$gradle_task"
if [ "$should_clean_gradle" = "true" ]; then
"$PROJECT_DIR/gradlew" --no-daemon clean "$gradle_task"
else
"$PROJECT_DIR/gradlew" --no-daemon "$gradle_task"
fi
if [ -n "$artifact_source" ] && [ -f "$artifact_source" ]; then
log "Renaming $(basename "$artifact_source") to $(basename "$artifact_target")"
@@ -777,11 +788,12 @@ maybe_run_operation() {
print_usage() {
cat <<EOF_USAGE
Usage: bash ./AndroidProjectTooling.sh [--build | --build-release-aab | --test | --test-emulator | --compile-git]
Usage: bash ./AndroidProjectTooling.sh [--build | --build-release-aab | --test | --clean-test | --test-emulator | --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
--compile-git Compile Git for the development host and all Android target ABIs
EOF_USAGE
@@ -789,7 +801,7 @@ EOF_USAGE
validate_args() {
case "${1:-}" in
""|--build|--build-release-aab|--test|--test-emulator|--compile-git)
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
;;
*)
echo "Unknown argument: $1" >&2
@@ -835,6 +847,7 @@ main() {
log "To set up and build in one step: bash ./AndroidProjectTooling.sh --build"
log "To set up and build a release AAB in one step: bash ./AndroidProjectTooling.sh --build-release-aab"
log "To set up and run unit tests with compiled host Git: bash ./AndroidProjectTooling.sh --test"
log "To clean and run unit tests with compiled host Git: bash ./AndroidProjectTooling.sh --clean-test"
log "To set up and run instrumentation tests on an emulator: bash ./AndroidProjectTooling.sh --test-emulator"
}