@@ -2,12 +2,16 @@ set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
22
33build_dir := " build"
44build_type := env_var_or_default (" CMAKE_BUILD_TYPE" , " RelWithDebInfo" )
5- # clang-tidy must understand C23 `constexpr`, which landed in Clang 19; the
6- # bare `clang-tidy` on this system still resolves to v18.
5+ # clang-tidy must understand C23 `constexpr`, which landed in Clang 19.
76clang_tidy := env_var_or_default (" CLANG_TIDY" , " clang-tidy-20" )
7+ run_clang_tidy := env_var_or_default (" RUN_CLANG_TIDY" , " run-clang-tidy-20" )
88clang_format := env_var_or_default (" CLANG_FORMAT" , " clang-format-20" )
99
10- default : lint build test install
10+ default : fmt build test install
11+
12+ ci : fmt-check build test
13+
14+ agent-checks : ci
1115
1216fmt :
1317 find src -type f \( -name ' *.c' -o -name ' *.h' -o -name ' *.h.in' \) -print0 | xargs -0 -r {{ clang_format}} -i
@@ -16,32 +20,7 @@ fmt-check:
1620 find src -type f \( -name ' *.c' -o -name ' *.h' -o -name ' *.h.in' \) -print0 | xargs -0 -r {{ clang_format}} --dry-run --Werror
1721
1822tidy :
19- cmake -S . -B {{ build_dir}} -DCMAKE_BUILD_TYPE={{ build_type}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
20- find src -type f -name ' *.c' -print0 | xargs -0 -r -n1 {{ clang_tidy}} -p {{ build_dir}}
21-
22- lint : fmt lint-legacy-context tidy
23-
24- # Core and BTech code must use scoped contexts rather than legacy aliases.
25- lint-legacy-context :
26- count=" $(rg -l '\b (mudstate|mudconf)\b ' src/mux src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy context used by $count source files" >&2 ; exit 1 ; }
27- count=" $(rg -o 'btech_context_(current_unthreaded|bind_unthreaded)|BTECH_EVALUATION_CONTEXT|\b DOCHECK(N|0|1)?\( ' src/mux src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy ambient BTech context usage returned ($count occurrences)" >&2 ; exit 1 ; }
28- count=" $(rg -o '\b (getMap|getMech|WhichSpecial|FindObjectsData|IsMech|IsAuto|IsMap)\( ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy BTech object lookup APIs used $count times" >&2 ; exit 1 ; }
29- count=" $(rg -o '\b (Number|Roll)\( |\b (init_genrand|genrand_[a-z0-9_]+)\( |\b rollstat\b |mt19937ar\. h' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy ambient BTech random API used $count times" >&2 ; exit 1 ; }
30- count=" $(rg -o '\b MissileHitTable\b |\b missile_hit_table_struct\b ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy mutable missile-hit table used $count times" >&2 ; exit 1 ; }
31- count=" $(rg -o 'MechWeapons\[ [^]]+\]\. (vrt|battlevalue)[[:space:]]*=' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " canonical weapon definitions mutated $count times" >&2 ; exit 1 ; }
32- count=" $(rg -o 'btech_context_evaluation\( ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -le 506 || { echo " ambient BTech evaluation accessor grew to $count uses (maximum 506)" >&2 ; exit 1 ; }
33- count=" $(rg -o 'LuaRuntime[[:space:]]*\*\* |\b spath_map\b ' src/mux src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " removed raw owner-slot or path-map global returned ($count occurrences)" >&2 ; exit 1 ; }
34- count=" $(rg -o '\b (MechIDS|GetMechID|GetMechToMechID|GetMechToMechID_base|UnitPartsList|TraceLOS|ShortArmorSectionString|getStatusString|AI_Info|auto_show_command|silly_get_uptime_to_string|silly_atr_get_from|my_dump_flag|sensor_mode_name|add_color|GetLRSMech|LRSTerrain|LRSElevation|get_lrshexstr|MakeMapText|BuildBitString|BuildBitString2|BuildBitString2WithDelim|BuildBitString3|PrintArmorDamageString|ArmorKeyInfo|RetrieveValue)\( ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy static-buffer helper returned ($count occurrences)" >&2 ; exit 1 ; }
35- count=" $(rg -o 'static char (buf|buf2|buffer)\[ [^]]+\] ' src/btech/src/glue.scode.c src/btech/src/btech/mech.sensor.c src/btech/src/btech/mech.status.c src/btech/src/btech/template.c src/btech/src/btech/mech.advanced.c | wc -l || true)" ; test " $count" -eq 0 || { echo " BTech callback or formatter static buffer returned ($count occurrences)" >&2 ; exit 1 ; }
36- count=" $(rg -o 'char[[:space:]]*\* [[:space:]]*(structure_name|center_string)\( ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " caller-owned formatter regressed to a pointer return ($count occurrences)" >&2 ; exit 1 ; }
37- count=" $(rg -o '\b (cachemech|cacheref)\b ' src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " ambient reference-mech cache returned ($count occurrences)" >&2 ; exit 1 ; }
38- count=" $(rg -o '\b DestroySpecialObjects\b |free\( server->configuration\) ' src/mux src/btech --glob '*.c' --glob '*.h' | wc -l || true)" ; test " $count" -eq 0 || { echo " legacy composition-root teardown returned ($count occurrences)" >&2 ; exit 1 ; }
39-
40- lint-changes :
41- git diff --name-only -z --diff-filter=ACMR HEAD -- src | while IFS= read -r -d ' ' file; do case " $file" in *.c|*.h|*.h.in) {{ clang_format}} -i " $file" ;; esac; done
42- just lint-legacy-context
43- cmake -S . -B {{ build_dir}} -DCMAKE_BUILD_TYPE={{ build_type}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
44- git diff --name-only -z --diff-filter=ACMR HEAD -- src | while IFS= read -r -d ' ' file; do case " $file" in *.c) {{ clang_tidy}} -p {{ build_dir}} " $file" ;; esac; done
23+ {{ run_clang_tidy}} -clang-tidy-binary {{ clang_tidy}} -p {{ build_dir}} -j " $(nproc)" ' ^.*/src/(mux|btech)/.*[.]c$'
4524
4625build :
4726 cmake -S . -B {{ build_dir}} -DCMAKE_BUILD_TYPE={{ build_type}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
@@ -50,12 +29,14 @@ build:
5029test :
5130 ctest --test-dir {{ build_dir}} --output-on-failure
5231
53- install : build
32+ install :
5433 cmake --install {{ build_dir}} --prefix " $PWD/game"
5534
5635run :
5736 cd game && ulimit -c unlimited && exec ./ stompymux stompymux.toml
5837
38+ install-and-run : install run
39+
5940docsite :
6041 npm --prefix docs run build
6142
0 commit comments