Merge bitcoin/bitcoin#31928: ci: Fix filtering out Qt-generated files from compile_commands.json

d82dc10415 ci: Fix filtering out Qt generated files from `compile_commands.json` (Hennadii Stepanov)

Pull request description:

  This PR:
  1. Adjusts the regex for Qt-generated files to match the CMake build directory structure.
  2. Moves the filtering command to run before `clang-tidy`, ensuring that Qt-generated files are not needlessly processed.

  Fixes https://github.com/bitcoin/bitcoin/issues/31801.

ACKs for top commit:
  maflcko:
    ACK d82dc10415 🚂

Tree-SHA512: 12ff40ffb134c56d848976e73aef7a8f895b856992b37b09ce27a1dcf6adef2cf148ba7e7d32b52ce1866c9bbeb165f9b6e6106c6c23b774d00d61bf379e13c9
This commit is contained in:
merge-script 2025-02-21 10:57:43 -05:00
commit f0ac24846f
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -164,16 +164,18 @@ if [ "${RUN_TIDY}" = "true" ]; then
cmake --build /tidy-build --target bitcoin-tidy-tests "$MAKEJOBS"
set -eo pipefail
# Filter out:
# * qt qrc and moc generated files
jq 'map(select(.file | test("src/qt/.*_autogen/.*\\.cpp$") | not))' "${BASE_BUILD_DIR}/compile_commands.json" > tmp.json
mv tmp.json "${BASE_BUILD_DIR}/compile_commands.json"
cd "${BASE_BUILD_DIR}/src/"
if ! ( run-clang-tidy-"${TIDY_LLVM_V}" -quiet -load="/tidy-build/libbitcoin-tidy.so" "${MAKEJOBS}" | tee tmp.tidy-out.txt ); then
grep -C5 "error: " tmp.tidy-out.txt
echo "^^^ ⚠️ Failure generated from clang-tidy"
false
fi
# Filter out:
# * qt qrc and moc generated files
jq 'map(select(.file | test("src/qt/qrc_.*\\.cpp$|/moc_.*\\.cpp$") | not))' "${BASE_BUILD_DIR}/compile_commands.json" > tmp.json
mv tmp.json "${BASE_BUILD_DIR}/compile_commands.json"
cd "${BASE_ROOT_DIR}"
python3 "/include-what-you-use/iwyu_tool.py" \
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \