From d5886c0c66568ac045ed1e0bc9dc4aed00e013a5 Mon Sep 17 00:00:00 2001 From: William Yang Date: Tue, 16 Mar 2021 09:49:11 +0100 Subject: [PATCH] chore(build): Get rel vsn fallback (#4339) --- src/emqx_app.erl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/emqx_app.erl b/src/emqx_app.erl index 4f8d47390..e62c85f25 100644 --- a/src/emqx_app.erl +++ b/src/emqx_app.erl @@ -70,18 +70,15 @@ get_description() -> Str -> string:strip(Str, both, $\n) end. --ifdef(TEST). -%% When testing, the 'cover' compiler stripps aways compile info -get_release() -> release_in_macro(). --else. -%% Otherwise print the build number, -%% which may have a git commit in its suffix. get_release() -> - {_, Vsn} = lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)), - VsnStr = release_in_macro(), - 1 = string:str(Vsn, VsnStr), %% assert - Vsn. --endif. + case lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)) of + false -> %% For TEST build or depedency build. + release_in_macro(); + {_, Vsn} -> %% For emqx release build + VsnStr = release_in_macro(), + 1 = string:str(Vsn, VsnStr), %% assert + Vsn + end. release_in_macro() -> element(2, ?EMQX_RELEASE).