2018-06-01 21:29:46 +02:00
|
|
|
#!/usr/bin/env bash
|
2014-11-28 02:09:42 +01:00
|
|
|
|
2014-11-28 02:12:19 +01:00
|
|
|
# Copyright 2014 Oliver Hahm <oliver.hahm@inria.fr>
|
2018-06-01 21:29:46 +02:00
|
|
|
# 2018 Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
# 2018 Alexandre Abadie <alexandre.abadie@inria.fr>
|
2014-11-28 02:12:19 +01:00
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
# directory for more details.
|
|
|
|
|
2017-04-25 21:00:21 +02:00
|
|
|
RIOTBASE=$(readlink -f "$(dirname $(realpath $0))/../../..")
|
|
|
|
|
2018-06-01 21:29:46 +02:00
|
|
|
if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
|
|
|
|
CERROR="\e[1;31m"
|
|
|
|
CWARN="\033[1;33m"
|
|
|
|
CRESET="\e[0m"
|
|
|
|
else
|
|
|
|
CERROR=
|
|
|
|
CWARN=
|
|
|
|
CRESET=
|
|
|
|
fi
|
|
|
|
|
2017-12-07 11:00:12 +01:00
|
|
|
ERRORS=$(make -C "${RIOTBASE}" doc 2>&1 | \
|
|
|
|
grep '.*warning' | \
|
|
|
|
sed "s#${PWD}/\([^:]*\)#\1#g")
|
2014-11-28 02:09:42 +01:00
|
|
|
|
2014-11-28 02:12:19 +01:00
|
|
|
if [ -n "${ERRORS}" ]
|
2014-11-28 02:09:42 +01:00
|
|
|
then
|
2018-06-01 21:29:46 +02:00
|
|
|
echo -e "${CERROR}ERROR: Doxygen generates the following warnings:${CRESET}"
|
2014-11-28 02:12:19 +01:00
|
|
|
echo "${ERRORS}"
|
2014-11-28 02:09:42 +01:00
|
|
|
exit 2
|
2018-06-01 21:29:46 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
exclude_filter() {
|
|
|
|
grep -v -e vendor -e examples -e tests
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check all groups are defined
|
|
|
|
DEFINED_GROUPS=$(git grep @defgroup -- '*.h' '*.c' '*.txt' | \
|
|
|
|
exclude_filter | \
|
|
|
|
grep -oE '@defgroup[ ]+[^ ]+' | \
|
|
|
|
grep -oE '[^ ]+$' | sort -u)
|
|
|
|
|
|
|
|
UNDEFINED_GROUPS=$( \
|
|
|
|
for group in $(git grep '@ingroup' -- '*.h' '*.c' '*.txt' | \
|
|
|
|
exclude_filter | \
|
|
|
|
grep -oE '[^ ]+$' | sort -u); \
|
|
|
|
do \
|
|
|
|
echo "${DEFINED_GROUPS}" | grep -xq "${group}" || echo "${group}"; \
|
|
|
|
done \
|
|
|
|
)
|
|
|
|
|
|
|
|
ALL_RAW_INGROUP=$(git grep '@ingroup' -- '*.h' '*.c' '*.txt' | exclude_filter)
|
|
|
|
|
|
|
|
UNDEFINED_GROUPS_PRINT=$( \
|
|
|
|
for group in ${UNDEFINED_GROUPS}; \
|
|
|
|
do \
|
|
|
|
echo -e "\n${CWARN}${group}${CRESET} found in:"; \
|
|
|
|
echo "${ALL_RAW_INGROUP}" | grep "\<${group}\>$" | sort -u | \
|
|
|
|
awk -F: '{ print "\t" $1 }'; \
|
|
|
|
done \
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ -n "${UNDEFINED_GROUPS}" ]
|
|
|
|
then
|
|
|
|
COUNT=$(echo "${UNDEFINED_GROUPS}" | wc -l)
|
|
|
|
echo -ne "${CWARN}WARNING${CRESET} "
|
|
|
|
echo -e "There are ${CWARN}${COUNT}${CRESET} undefined Doxygen groups:"
|
|
|
|
echo "${UNDEFINED_GROUPS_PRINT}"
|
2014-11-28 02:09:42 +01:00
|
|
|
fi
|