Files
file-manager/tools/verify.sh
T
SoftwareApp 2690e53662 The release gate names the baseline-profile task it means
verify.sh --release asked for :baselineprofile:assembleBenchmark, which the baseline-profile plugin made ambiguous when it added a benchmark flavour on top of the benchmark build type - so the task failed before the release build, and the nightly release job has been red without anyone seeing it. The ambiguous name is replaced with assembleBenchmarkBenchmark, with a comment saying why it is spelled out. verify.sh --release is green again.
2026-10-18 11:21:15 +02:00

60 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# The gate. Everything that has to be true before a change is finished, in one command:
#
# ./tools/verify.sh # what every change has to pass
# ./tools/verify.sh --release # ...and an R8 release build, which is what the nightly runs
# GRADLE_FLAGS=--offline ./tools/verify.sh # keeps working without a network
#
# Cheapest first, so a stale document fails in a second rather than after a release build. Each step
# is here because it has caught a real defect in this project at least once; nothing is on the list
# because it is fashionable.
set -euo pipefail
cd "$(dirname "$0")/.."
release=false
for arg in "$@"; do
case "$arg" in
--release) release=true ;;
*) echo "verify: unknown option '$arg' (only --release is understood)" >&2; exit 2 ;;
esac
done
# Word splitting is intended here: GRADLE_FLAGS is a place to put several flags.
# shellcheck disable=SC2086
gradle() { ./gradlew ${GRADLE_FLAGS:-} "$@" --console=plain; }
step() { printf '\n\033[1m== %s\033[0m\n' "$1"; }
step "Code map is current"
python3 tools/make-code-map.py --check
step "Kotlin static analysis (detekt, against the baseline)"
gradle :app:detekt
step "JVM unit tests"
gradle :app:testDebugUnitTest
step "Android Lint"
gradle :app:lintDebug
if $release; then
step "Release build (R8)"
# Signed when keystore.properties happens to be present, unsigned otherwise — either way R8
# runs, and a release-only defect (a class reached only through a resource, for instance) is
# exactly what this step is for.
gradle :app:assembleRelease
step "Benchmark APKs compile"
# No device: this only proves that :benchmark still compiles against the app's benchmark build
# type, which is the thing that rots silently between device runs. :baselineprofile is included for
# the same reason — its generator only runs on a device with API 33+, so nothing else would notice it
# breaking. The task is spelled out in full because the baseline-profile plugin adds a `benchmark`
# flavour on top of the `benchmark` build type: `assembleBenchmark` is ambiguous between the flavour's
# two types, and Gradle refuses it — which is how this line came to be wrong without anything noticing.
gradle :app:assembleBenchmark :benchmark:assembleDebug :baselineprofile:assembleBenchmarkBenchmark
fi
printf '\n\033[1mverify: all checks passed\033[0m\n'