#!/usr/bin/env bash # Two questions about Gradle's configuration cache. Called by the `configuration-cache` job of # .gitea/workflows/main.yml and by scripts/verify.sh main. # 1. Can every repository-wide gate be stored? A property of the task graph, so --dry-run answers it # for all of them in seconds without running a lane. # 2. Is a stored entry reused while the build still executes its work? Checked on the two core # leaves, whose check runs in a minute. # prCheck and verifyStrictLaneStages are not in the list: the strict-lane check reads the task graph # itself and is declared incompatible, and prCheck is ci plus scripts. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/../.." reused() { # gradle arguments...; fails unless the second identical run reuses the stored entry ./gradlew "$@" --configuration-cache --configuration-cache-problems=fail output=$(./gradlew "$@" --configuration-cache --configuration-cache-problems=fail 2>&1) printf '%s\n' "${output}" grep -Fq 'Reusing configuration cache.' <<<"${output}" || { echo "configuration cache: not reused for: $*" >&2 exit 1 } } for gate in ci mainCheck integrationCheck releaseCheck; do reused "${gate}" --dry-run done reused :domain-core:check :application-core:check