Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
21 lines
874 B
Bash
Executable File
21 lines
874 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# What a Maven cache is worth: the same build against an empty and a populated local repository.
|
|
source "$(dirname "$0")/lib.sh"
|
|
REPO="${COLD_REPO:-/tmp/m2-cold-demo}"
|
|
rm -rf "$REPO"
|
|
run() { # label
|
|
local start end n
|
|
start=$(date +%s)
|
|
mvn -B -Dmaven.repo.local="$REPO" -DskipITs verify > /tmp/cache-run.log 2>&1 || { tail -20 /tmp/cache-run.log; exit 1; }
|
|
end=$(date +%s)
|
|
n=$(grep -c 'Downloaded from' /tmp/cache-run.log || true)
|
|
printf '%-34s downloads: %-5s seconds: %s\n' "$1" "$n" "$((end-start))"
|
|
}
|
|
{
|
|
banner "mvn verify -DskipITs, local repository = $REPO"
|
|
run "cold (empty local repository)"
|
|
run "warm (repository restored)"
|
|
printf 'local repository size after the run: %s\n' "$(du -sh "$REPO" | cut -f1)"
|
|
echo "(seconds depend on the network; the download counts are the point)"
|
|
} 2>&1 | tee "$OUT/02-cold-vs-warm-cache.txt"
|