mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
ci, iwyu: Treat warnings as errors for specific directories
Currently, this applies only to the `crypto` and `index` directories.
This commit is contained in:
@@ -213,14 +213,30 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
||||
false
|
||||
fi
|
||||
|
||||
# TODO: Consider enforcing IWYU across the entire codebase.
|
||||
FILES_WITH_ENFORCED_IWYU="/src/(crypto|index)/.*\\.cpp"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json"
|
||||
|
||||
cd "${BASE_ROOT_DIR}"
|
||||
python3 "/include-what-you-use/iwyu_tool.py" \
|
||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||
-Xiwyu --max_line_length=160 \
|
||||
2>&1 | tee /tmp/iwyu_ci.out
|
||||
cd "${BASE_ROOT_DIR}/src"
|
||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
||||
|
||||
run_iwyu() {
|
||||
mv "${BASE_BUILD_DIR}/$1" "${BASE_BUILD_DIR}/compile_commands.json"
|
||||
python3 "/include-what-you-use/iwyu_tool.py" \
|
||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||
-Xiwyu --max_line_length=160 \
|
||||
2>&1 | tee /tmp/iwyu_ci.out
|
||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
||||
}
|
||||
|
||||
run_iwyu "compile_commands_iwyu_errors.json"
|
||||
if ! ( git --no-pager diff --exit-code ); then
|
||||
echo "^^^ ⚠️ Failure generated from IWYU"
|
||||
false
|
||||
fi
|
||||
|
||||
run_iwyu "compile_commands_iwyu_warnings.json"
|
||||
git --no-pager diff
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user