chore(build): Get rel vsn fallback (#4339)
This commit is contained in:
parent
ef1be26bc8
commit
d5886c0c66
|
@ -70,18 +70,15 @@ get_description() ->
|
||||||
Str -> string:strip(Str, both, $\n)
|
Str -> string:strip(Str, both, $\n)
|
||||||
end.
|
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() ->
|
get_release() ->
|
||||||
{_, Vsn} = lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)),
|
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(),
|
VsnStr = release_in_macro(),
|
||||||
1 = string:str(Vsn, VsnStr), %% assert
|
1 = string:str(Vsn, VsnStr), %% assert
|
||||||
Vsn.
|
Vsn
|
||||||
-endif.
|
end.
|
||||||
|
|
||||||
release_in_macro() ->
|
release_in_macro() ->
|
||||||
element(2, ?EMQX_RELEASE).
|
element(2, ?EMQX_RELEASE).
|
||||||
|
|
Loading…
Reference in New Issue