build: do not generate desc.en.hocon if jq command is not found

This commit is contained in:
Zaiming (Stone) Shi 2023-11-09 18:14:56 +01:00
parent 5990f9835f
commit fd205f599c
1 changed files with 17 additions and 6 deletions

19
build
View File

@ -12,6 +12,12 @@ if [ "${DEBUG:-0}" -eq 1 ]; then
export DIAGNOSTIC=1
fi
log_red() {
local RED='\033[0;31m' # Red
local NC='\033[0m' # No Color
echo -e "${RED}${1}${NC}"
}
PROFILE_ARG="$1"
ARTIFACT="$2"
@ -34,7 +40,7 @@ case "$(is_enterprise "$PROFILE_ARG"),$(is_enterprise "$PROFILE_ENV")" in
true
;;
*)
echo "PROFILE env var is set to '$PROFILE_ENV', but '$0' arg1 is '$PROFILE_ARG'"
log_red "PROFILE env var is set to '$PROFILE_ENV', but '$0' arg1 is '$PROFILE_ARG'"
exit 1
;;
esac
@ -134,8 +140,13 @@ make_docs() {
"ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \
halt(0)."
local desc="$docdir/desc.en.hocon"
if command -v jq &> /dev/null; then
log "Generating $desc"
scripts/merge-i18n.escript | jq --sort-keys . > "$desc"
else
# it is not a big deal if we cannot generate the desc
log_red "NOT Generated: $desc"
fi
}
## arg1 is the profile for which the following args (as app names) should be excluded
@ -152,8 +163,8 @@ assert_no_excluded_deps() {
for app in "${excluded_apps[@]}"; do
found="$($FIND "$rel_dir" -maxdepth 1 -type d -name "$app-*")"
if [ -n "${found}" ]; then
echo "ERROR: ${app} should not be included in ${PROFILE}"
echo "ERROR: found ${app} in ${rel_dir}"
log_red "ERROR: ${app} should not be included in ${PROFILE}"
log_red "ERROR: found ${app} in ${rel_dir}"
exit 1
fi
done
@ -294,7 +305,7 @@ make_tgz() {
mkdir -p "${tard}/emqx"
mkdir -p "${pkgpath}"
if [ ! -f "$src_tarball" ]; then
log "ERROR: $src_tarball is not found"
log_red "ERROR: $src_tarball is not found"
fi
$TAR zxf "${src_tarball}" -C "${tard}/emqx"
if [ -f "${tard}/emqx/releases/${PKG_VSN}/relup" ]; then