From c607e73739ea655602999d593d836a00f1ee0f6c Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Mon, 25 Nov 2024 12:00:59 +0300 Subject: [PATCH] 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 --- scripts/deploy.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 90e48a48..de5844f5 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -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 "${?}"