Merge pull request #10633 from zmstone/0508-lower-prio-default-profile-in-ERL_LIBS

build: order _build/$PROFILE/lib before 'default' profile libs
This commit is contained in:
Zaiming (Stone) Shi 2023-05-25 16:05:35 +02:00 committed by GitHub
commit 8d6652f162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 18 deletions

View File

@ -111,8 +111,14 @@ jobs:
timeout-minutes: 5
run: |
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx start
Start-Sleep -s 5
echo "EMQX started"
Start-Sleep -s 10
$pingOutput = ./_build/${{ matrix.profile }}/rel/emqx/bin/emqx ping
if ($pingOutput = 'pong') {
echo "EMQX started OK"
} else {
echo "Failed to ping EMQX $pingOutput"
Exit 1
}
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx stop
echo "EMQX stopped"
./_build/${{ matrix.profile }}/rel/emqx/bin/emqx install

39
build
View File

@ -91,19 +91,28 @@ log() {
echo "===< $msg"
}
prepare_erl_libs() {
local libs_dir="$1"
local erl_libs="${ERL_LIBS:-}"
local sep
if [ "${SYSTEM}" = 'windows' ]; then
sep=';'
else
sep=':'
fi
for app in "${libs_dir}"/*; do
if [ -d "${app}/ebin" ]; then
if [ -n "$erl_libs" ]; then
erl_libs="${erl_libs}${sep}${app}"
else
erl_libs="${app}"
fi
fi
done
export ERL_LIBS="$erl_libs"
}
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
'yes')
SCHEMA_MODULE='emqx_enterprise_schema'
@ -112,10 +121,12 @@ make_docs() {
SCHEMA_MODULE='emqx_conf_schema'
;;
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"
# shellcheck disable=SC2086
erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \
erl -noshell -eval \
"ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \
halt(0)."
}

15
dev
View File

@ -58,6 +58,7 @@ fi
export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'
export EMQX_LOG__FILE__DEFAULT__ENABLE='false'
export EMQX_LOG__CONSOLE__ENABLE='true'
SYSTEM="$(./scripts/get-distro.sh)"
EMQX_NODE_NAME="${EMQX_NODE_NAME:-emqx@127.0.0.1}"
PROFILE="${PROFILE:-emqx}"
FORCE_COMPILE=0
@ -157,14 +158,24 @@ fi
prepare_erl_libs() {
local profile="$1"
local libs_dir="_build/${profile}/lib"
local erl_libs=''
local erl_libs="${ERL_LIBS:-}"
local sep
if [ "${SYSTEM}" = 'windows' ]; then
sep=';'
else
sep=':'
fi
if [ $FORCE_COMPILE -eq 1 ] || [ ! -d "$libs_dir" ]; then
make "compile-${PROFILE}"
else
echo "Running from code in $libs_dir"
fi
for app in "${libs_dir}"/*; do
erl_libs="${erl_libs}:${app}"
if [ -n "$erl_libs" ]; then
erl_libs="${erl_libs}${sep}${app}"
else
erl_libs="${app}"
fi
done
export ERL_LIBS="$erl_libs"
}