Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-16 08:46:35

0001 #!/usr/bin/env bash
0002 # Emit a record only after both collection and JSON validation succeed.
0003 # Reporting must never change the build outcome.
0004 set -uo pipefail
0005 
0006 if ! command -v jq >/dev/null 2>&1; then
0007   echo '::warning::ccache JSON statistics unavailable: jq is not installed' >&2
0008   exit 0
0009 fi
0010 if ! stats=$(ccache --print-stats --format=json); then
0011   echo '::warning::ccache JSON statistics unavailable: collection failed (JSON support required)' >&2
0012   exit 0
0013 fi
0014 if ! stats=$(printf '%s\n' "$stats" | jq -ce 'select(type == "object" and has("cache_miss") and has("direct_cache_hit"))'); then
0015   echo '::warning::ccache JSON statistics unavailable: invalid statistics' >&2
0016   exit 0
0017 fi
0018 printf 'CCACHE_STATS %s\n' "$stats"