Route native Ninja compiler calls through ccache

Windows searches the launching executable directory before PATH. Stage the CI copy of Ninja alongside the installed ccache shims and point ccache at the original CLANG64 toolchain. Log the detailed compiler counters.
This commit is contained in:
YXC0915 committed 2026-12-04 19:27:10 +08:00
1 parent 9a8a776418
commit 4f31eee07b
1 file changed
+12 -7
+12 -7
View File
@@ -195,7 +195,7 @@ jobs:
- name: Cache compiler objects and Cargo downloads
if: steps.plan.outputs.skip != 'true'
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
${{ runner.temp }}/compiler-cache/ccache
@@ -219,15 +219,20 @@ jobs:
run: |
set -euo pipefail
cd "$(cygpath -u "$UPSTREAM_DIR")"
# The installer selects clang/clang++ itself. MSYS2's ccache
# compiler shims forward those names to the real CLANG64 tools.
export PATH="$MINGW_PREFIX/lib/ccache/bin:$PATH"
export CCACHE_DIR="$(cygpath -m "$RUNNER_TEMP")/compiler-cache/ccache"
export SCCACHE_DIR="$(cygpath -m "$RUNNER_TEMP")/compiler-cache/sccache"
# Native Ninja searches its own directory for the installer's bare
# clang/clang++ names before PATH. Put the cache shims beside its CI copy.
temp_dir="$(cygpath -u "$RUNNER_TEMP")"
tools_dir="$temp_dir/compiler-tools"
mkdir -p "$tools_dir"
cp "$MINGW_PREFIX/bin/ninja.exe" "$MINGW_PREFIX/lib/ccache/bin/"clang{,++}.exe "$tools_dir/"
export PATH="$tools_dir:$PATH"
export CCACHE_PATH="$(cygpath -m "$MINGW_PREFIX/bin")"
export CCACHE_DIR="$(cygpath -m "$temp_dir")/compiler-cache/ccache"
export SCCACHE_DIR="$(cygpath -m "$temp_dir")/compiler-cache/sccache"
export RUSTC_WRAPPER="$(cygpath -m "$MINGW_PREFIX/bin/sccache.exe")"
ccache --zero-stats
sccache --start-server
trap 'ccache --show-stats; sccache --stop-server' EXIT
trap 'ccache --show-stats --verbose; sccache --stop-server' EXIT
# Upstream's own non-interactive CLANG64 build script.
bash scripts/install-ctl.sh --yes
util_repo="$(cygpath -u "$REIMS_UTIL_DIR")"