mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-29 07:13:44 +08:00
verify_compiler() in scripts/env.sh ran `file` on the clang path and grepped for arm64/universal. Nix's clang is a bash wrapper script, so `file` reports "ASCII text executable" and the check falsely concluded "x86_64 only", aborting before any compile. Replace it with a capability probe: compile + link a trivial program for the target -arch and trust the result — correct for wrapper scripts (Nix, ccache) and cross-compilers. Make arch targeting explicit and toolchain-agnostic: export ARCHFLAGS="-arch <arch>" from env.sh and fold it into CC/CXX in Makefile.cbm via `override`, so it reaches every compile and link (including the vendored objects) and survives a command-line CC= override. This replaces the `arch -<arch> make` prefix, which cannot work with Nix's fixed-target clang. Drop the now-redundant ARCH_PREFIX from build/test/lint/repro. Refs #705. Signed-off-by: Kris Williams <115474+kriswill@users.noreply.github.com>
47 lines
1.3 KiB
Bash
Executable File
47 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# lint.sh — Run all linters (clang-tidy + cppcheck + clang-format).
|
|
#
|
|
# Usage:
|
|
# scripts/lint.sh # All 3 linters
|
|
# scripts/lint.sh CLANG_FORMAT=clang-format-20 # Override formatter
|
|
# scripts/lint.sh --ci # CI mode (skip clang-tidy)
|
|
#
|
|
# This script is the SINGLE source of truth for linting.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
# shellcheck source=env.sh
|
|
source "$ROOT/scripts/env.sh"
|
|
|
|
# Check for --ci flag (skip clang-tidy for platforms without it)
|
|
CI_ONLY=false
|
|
MAKE_ARGS=()
|
|
for arg in "$@"; do
|
|
if [ "$arg" = "--ci" ]; then
|
|
CI_ONLY=true
|
|
else
|
|
MAKE_ARGS+=("$arg")
|
|
fi
|
|
done
|
|
|
|
print_env "lint.sh"
|
|
|
|
# No-skips policy: every test must pass or fail. The only tolerable skip is a
|
|
# genuinely platform-specific test (SKIP_PLATFORM / #ifdef). Runs in both modes.
|
|
echo "=== no-skips policy (tests pass or fail) ==="
|
|
bash "$ROOT/scripts/check-no-test-skips.sh"
|
|
|
|
if $CI_ONLY; then
|
|
echo "=== CI mode: cppcheck + clang-format ==="
|
|
make -j2 -f Makefile.cbm lint-ci "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
|
|
echo "=== CI linters passed ==="
|
|
else
|
|
echo "=== Full lint: clang-tidy + cppcheck + clang-format ==="
|
|
make -j3 -f Makefile.cbm lint "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
|
|
fi
|
|
|
|
echo "=== All linters passed ==="
|