Langs check (#2006)

* source/Makefile: add temp change for demo

* scripts/deploy.sh: add test check for languages

* scripts/deploy.sh: shellcheck sanitization

* source/Makefile: revert changes for the demo
This commit is contained in:
Ivan Zorin
2024-11-25 12:00:59 +03:00
committed by GitHub
parent 9794e028b6
commit c607e73739

View File

@@ -90,6 +90,22 @@ docs_history()
return "${ret}"
}
# source/Makefile:ALL_LANGUAGES & Translations/*.json automagical routine
build_langs()
{
mk="../source/Makefile"
cd Translations/ || exit 1
langs="$(echo "$(find ./*.json | sed -ne 's,^\./translation_,,; s,\.json$,,; /[A-Z]/p' ; sed -ne 's/^ALL_LANGUAGES=//p;' "${mk}")" | sed 's, ,\n,g; s,\r,,g' | sort | uniq -u)"
ret=0
if [ -n "${langs}" ]; then
ret=1
echo "It seems there is mismatch between supported languages and enabled builds."
echo "Please, check files in Translations/ and ALL_LANGUAGES variable in source/Makefile for:"
echo "${langs}"
fi;
return "${ret}"
}
# Helper function to check code style using clang-format & grep/sed custom parsers:
# - basic logic moved from source/Makefile : `check-style` target for better maintainance since a lot of sh script involved;
# - output goes in gcc-like error compatible format for IDEs/editors.
@@ -173,7 +189,9 @@ if [ "docs" = "${cmd}" ]; then
readme="${?}"
docs_history
hist="${?}"
if [ "${readme}" -eq 0 ] && [ "${hist}" -eq 0 ]; then
build_langs
langs="${?}"
if [ "${readme}" -eq 0 ] && [ "${hist}" -eq 0 ] && [ "${langs}" -eq 0 ]; then
ret=0
else
ret=1
@@ -195,6 +213,11 @@ if [ "docs_history" = "${cmd}" ]; then
exit "${?}"
fi;
if [ "build_langs" = "${cmd}" ]; then
build_langs
exit "${?}"
fi;
if [ "check_style_file" = "${cmd}" ]; then
check_style_file "${2}"
exit "${?}"