Преглед на файлове

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

Zaiming (Stone) Shi преди 2 години
родител
ревизия
fd205f599c
променени са 1 файла, в които са добавени 17 реда и са изтрити 6 реда
  1. 17 6
      build

+ 17 - 6
build

@@ -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"
-    log "Generating $desc"
-    scripts/merge-i18n.escript | jq --sort-keys . > "$desc"
+    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