Skip to content
Snippets Groups Projects
Commit 85f37cf2 authored by René Paris's avatar René Paris
Browse files

Merge branch 'fix/version_comparison' into 'master'

fix(ci): reimplement version comparison

See merge request !126
parents c4286896 c2c68b5a
No related branches found
No related tags found
1 merge request!126fix(ci): reimplement version comparison
Pipeline #32519 passed
......@@ -14,25 +14,54 @@
# This script checks the inline documentation using doxygen
################################################################################
filter() {
local version="$1"
local message="$2"
local sed_command="$3"
# Version Comparison
# Based on: https://unix.stackexchange.com/a/285928
# Creator: Luciano Andress Martini
# Licence: CC BY-SA 4.0 - https://creativecommons.org/licenses/by-sa/4.0/
if [ "$(printf '%s\n' "$version" "$doxy_version" | sort -V | head -n1)" = "$version" ]; then
echo "Filtering warning/errors for doxygen $version: $message"
# compare two versions using semantic version syntax
#
# usage: greater_or_equal "1.2.3" "2.3.4"
# param lhs: left hand side of the operation "lhs >= rhs"
# param rhs: right hand side of the operation "lhs >= rhs"
greater_or_equal()
{
local v_lhs="$1"
local v_rhs="$2"
local version_regex='([0-9]+\.[0-9]+\.[0-9]+)'
[[ $v_lhs =~ $version_regex ]] && v_lhs=${BASH_REMATCH[1]}
[[ $v_rhs =~ $version_regex ]] && v_rhs=${BASH_REMATCH[1]}
IFS='.' read -r -a i_lhs <<< "$v_lhs"
IFS='.' read -r -a i_rhs <<< "$v_rhs"
for ((i = 0; i < ${#i_rhs[@]}; i++)); do
if [ "${i_rhs[i]}" -gt "${i_lhs[i]}" ]; then
return 1
fi
done
return 0
}
sed_if_greater_or_equal()
{
local lhs="$1"
local rhs="$2"
local message="$3"
local sed_command="$4"
if greater_or_equal "$lhs" "$rhs"; then
echo "Filtering warning/errors for doxygen "$lhs": $message"
echo "sed -i \"$sed_command\" \"doc/DoxygenWarningLog.txt\""
sed -i "$sed_command" "doc/DoxygenWarningLog.txt"
fi
}
filter()
{
sed_if_greater_or_equal $doxy_version "${1}" "${2}" "${3}"
}
MYDIR="$(dirname "$(readlink -f "$0")")"
cd "$MYDIR/../../../../build" || exit 1
doxy_version="$(doxygen --version)"
doxy_version="$(doxygen --version | grep -oP '[0-9]+\.[0-9]+\.[0-9]+')"
echo "Doxygen Version $doxy_version"
make MantleAPI_doc
......@@ -54,7 +83,6 @@ filter "1.9.1" \
"Warning: floating_point_helper: Exlicit link request to 'epsilon()' could not be resolved" \
"/warning: explicit link request to 'epsilon()' could not be resolved/d"
# bug description - https://github.com/doxygen/doxygen/issues/8091
filter "1.9.7" \
"Warnings \"Member MantleAPI_ ... is not documented\" (see https://github.com/doxygen/doxygen/issues/8091)" \
......@@ -75,7 +103,6 @@ sed -i "/error: Problems running gswin32c.exe. Check your installation\!/d" "doc
# remove blank lines
sed -i '/^\s*$/d' "doc/DoxygenWarningLog.txt"
if [ -s "doc/DoxygenWarningLog.txt" ]; then
echo "ERROR: Doxygen warnings"
cat "doc/DoxygenWarningLog.txt"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment