1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

dist/tools/externc: annotate errors in Github Action

This commit is contained in:
Martine Lenders 2020-12-15 20:53:17 +01:00
parent f1600af701
commit 628b45d975
No known key found for this signature in database
GPG Key ID: CCD317364F63286F

View File

@ -13,6 +13,9 @@ cd $RIOTBASE
: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
. "${RIOTTOOLS}"/ci/changed_files.sh
. "${RIOTTOOLS}"/ci/github_annotate.sh
github_annotate_setup
# prepare
ROOT=$(git rev-parse --show-toplevel)
@ -28,9 +31,24 @@ for FILE in ${FILES}; do
| sed -e 's/ */ /g' \
| grep -v -q '#ifdef __cplusplus extern "C" {'; \
then
ANNOTATION="File does not have a C++ compatible header"
EXIT_CODE=1
echo "file does not have a C++ compatible header: '${FILE}'"
echo "${ANNOTATION}: '${FILE}'"
ANNOTATION="${ANNOTATION}.\nPlease add:\n\n"
ANNOTATION="${ANNOTATION}"'```C\n'
ANNOTATION="${ANNOTATION}#ifdef __cplusplus\n"
ANNOTATION="${ANNOTATION}extern \"C\" {\n"
ANNOTATION="${ANNOTATION}#endif\n\n"
ANNOTATION="${ANNOTATION}/* your file content */\n\n"
ANNOTATION="${ANNOTATION}"'#ifdef __cplusplus\n'
ANNOTATION="${ANNOTATION}}\n"
ANNOTATION="${ANNOTATION}"'#endif\n'
ANNOTATION="${ANNOTATION}"'```\n\n'
ANNOTATION="${ANNOTATION}after your header \`#include\`s"
github_annotate_error "${FILE}" 0 "${ANNOTATION}"
fi
done
github_annotate_teardown
exit ${EXIT_CODE}