LlvmToolChecker
Runtime cross-check that every LLVM binary in StigLlvmToolchain is present on PATH and reports the expected LLVM_MAJOR.
Defence-in-depth complement to the StigLlvmToolchain registry:
The registry pins all tool names to
LLVM_MAJOR = "18"(one edit point in source).This checker verifies, at task run-time, that
clang-18andclang++-18actually resolve to clang reporting major 18 (a wrong PATH symlink can otherwise silently mismatch after a system upgrade).
Designed as a process-singleton rather than a Gradle BuildService because the user explicitly asked to avoid the Service abstraction. First call to verifyAllOnce runs --version against every binary in the registry, parses the major, and throws on the first mismatch. Subsequent calls within the same JVM are no-ops via checked. Roughly ~500 ms cost on first invocation; zero thereafter.
Where to call it. Any task that invokes an LLVM binary should call verifyAllOnce near the top of its @TaskAction. The check fires once per ./gradlew … invocation; subsequent tasks in the same build pay nothing.
What it does NOT do. No per-binary granularity (the registry is monolithic — if one tool's major is wrong, every downstream task would mismatch anyway). No retry, no warning-only mode — a version skew is unrecoverable for this pipeline, so failure is always fatal.
Functions
Runs <tool> --version against every binary in allTools exactly once per JVM. On version mismatch or exec failure, throws — the first violation kills the build with a precise remediation hint. No-ops on subsequent calls in the same Gradle invocation.