build: order _build/$PROFILE/lib before 'default' profile libs

This commit is contained in:
Zaiming (Stone) Shi 2023-05-08 10:55:16 +02:00
parent c15e2f8708
commit dee21d2ccf
2 changed files with 16 additions and 15 deletions

29
build
View File

@ -91,19 +91,18 @@ log() {
echo "===< $msg" echo "===< $msg"
} }
prepare_erl_libs() {
local libs_dir="$1"
local erl_libs="${ERL_LIBS:-}"
for app in "${libs_dir}"/*; do
if [ -d "${app}/ebin" ]; then
erl_libs="${erl_libs}:${app}"
fi
done
export ERL_LIBS="$erl_libs"
}
make_docs() { make_docs() {
local libs_dir1 libs_dir2 libs_dir3 docdir
libs_dir1="$("$FIND" "_build/$PROFILE/lib/" -maxdepth 2 -name ebin -type d)"
if [ -d "_build/default/lib/" ]; then
libs_dir2="$("$FIND" "_build/default/lib/" -maxdepth 2 -name ebin -type d)"
else
libs_dir2=''
fi
if [ -d "_build/$PROFILE/checkouts" ]; then
libs_dir3="$("$FIND" "_build/$PROFILE/checkouts/" -maxdepth 2 -name ebin -type d 2>/dev/null || true)"
else
libs_dir3=''
fi
case "$(is_enterprise "$PROFILE")" in case "$(is_enterprise "$PROFILE")" in
'yes') 'yes')
SCHEMA_MODULE='emqx_enterprise_schema' SCHEMA_MODULE='emqx_enterprise_schema'
@ -112,10 +111,12 @@ make_docs() {
SCHEMA_MODULE='emqx_conf_schema' SCHEMA_MODULE='emqx_conf_schema'
;; ;;
esac esac
docdir="_build/docgen/$PROFILE" prepare_erl_libs "_build/$PROFILE/checkouts"
prepare_erl_libs "_build/$PROFILE/lib"
local docdir="_build/docgen/$PROFILE"
mkdir -p "$docdir" mkdir -p "$docdir"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \ erl -noshell -eval \
"ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \ "ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \
halt(0)." halt(0)."
} }

2
dev
View File

@ -157,7 +157,7 @@ fi
prepare_erl_libs() { prepare_erl_libs() {
local profile="$1" local profile="$1"
local libs_dir="_build/${profile}/lib" local libs_dir="_build/${profile}/lib"
local erl_libs='' local erl_libs="${ERL_LIBS:-}"
if [ $FORCE_COMPILE -eq 1 ] || [ ! -d "$libs_dir" ]; then if [ $FORCE_COMPILE -eq 1 ] || [ ! -d "$libs_dir" ]; then
make "compile-${PROFILE}" make "compile-${PROFILE}"
else else