ci, iwyu: Treat warnings as errors for specific directories
Currently, this applies only to the `crypto` and `index` directories.
This commit is contained in:
1 file changed
+23
-7
@@ -213,14 +213,30 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
|||||||
false
|
false
|
||||||
fi
|
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}"
|
cd "${BASE_ROOT_DIR}"
|
||||||
python3 "/include-what-you-use/iwyu_tool.py" \
|
|
||||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
run_iwyu() {
|
||||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
mv "${BASE_BUILD_DIR}/$1" "${BASE_BUILD_DIR}/compile_commands.json"
|
||||||
-Xiwyu --max_line_length=160 \
|
python3 "/include-what-you-use/iwyu_tool.py" \
|
||||||
2>&1 | tee /tmp/iwyu_ci.out
|
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||||
cd "${BASE_ROOT_DIR}/src"
|
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
-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
|
git --no-pager diff
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user