chore(build): add more enterprise build support

This commit is contained in:
Zaiming Shi 2021-03-06 10:53:47 +01:00
parent 1af1dd17b5
commit 00a2daba19
4 changed files with 22 additions and 5 deletions

View File

@ -27,6 +27,13 @@
%% NOTE: This version number should be manually bumped for each release
-define(EMQX_RELEASE, "4.3-beta.1").
-ifndef(EMQX_ENTERPRISE).
-define(EMQX_RELEASE, {opensource, "4.3-beta.1"}).
-else.
-endif.
-endif.

View File

@ -6,7 +6,13 @@ set -euo pipefail
# ensure dir
cd -P -- "$(dirname -- "$0")"
RELEASE="$(grep -E 'define.+EMQX_RELEASE,' include/emqx_release.hrl | cut -d '"' -f2)"
if [ -f EMQX_ENTERPRISE ]; then
EDITION='enterprise'
else
EDITION='opensource'
fi
RELEASE="$(grep -E "define.+EMQX_RELEASE.+${EDITION}" include/emqx_release.hrl | cut -d '"' -f2)"
if [ -d .git ] && ! git describe --tags --match "${RELEASE}" --exact >/dev/null 2>&1; then
SUFFIX="-$(git rev-parse HEAD | cut -b1-8)"

View File

@ -204,9 +204,9 @@ relx_plugin_apps(ReleaseType) ->
, emqx_recon
, emqx_rule_engine
, emqx_sasl
, emqx_telemetry
, emqx_modules
]
++ [emqx_telemetry || not is_enterprise()]
++ relx_plugin_apps_per_rel(ReleaseType)
++ relx_plugin_apps_enterprise(is_enterprise())
++ relx_plugin_apps_extra().

View File

@ -64,16 +64,20 @@ print_vsn() ->
-ifdef(TEST).
%% When testing, the 'cover' compiler stripps aways compile info
get_release() -> ?EMQX_RELEASE.
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)),
?EMQX_RELEASE ++ _ = Vsn, %% assert
VsnStr = release_in_macro(),
1 = string:str(Vsn, VsnStr), %% assert
Vsn.
-endif.
release_in_macro() ->
element(2, ?EMQX_RELEASE).
%%--------------------------------------------------------------------
%% Autocluster
%%--------------------------------------------------------------------