chore(build): use only mark file to tell apart ce ee

This commit is contained in:
Zaiming Shi 2021-03-02 23:32:25 +01:00
parent 292358dc38
commit cd0890796d
3 changed files with 15 additions and 5 deletions

View File

@ -3,7 +3,6 @@ DASHBOARD_VERSION = v4.3.0-beta.1
REBAR = $(CURDIR)/rebar3 REBAR = $(CURDIR)/rebar3
BUILD = $(CURDIR)/build BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts SCRIPTS = $(CURDIR)/scripts
export EMQX_ENTERPRISE=false
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh) export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
PROFILE ?= emqx PROFILE ?= emqx

View File

@ -22,6 +22,7 @@ overrides() ->
[ {add, [ {extra_src_dirs, [{"etc", [{recursive,true}]}]} [ {add, [ {extra_src_dirs, [{"etc", [{recursive,true}]}]}
, {erl_opts, [ deterministic , {erl_opts, [ deterministic
, {compile_info, [{emqx_vsn, get_vsn()}]} , {compile_info, [{emqx_vsn, get_vsn()}]}
| [{d, 'EMQX_ENTERPRISE'} || is_enterprise()]
]} ]}
]} ]}
]. ].
@ -32,9 +33,11 @@ config() ->
, {project_app_dirs, project_app_dirs()} , {project_app_dirs, project_app_dirs()}
]. ].
is_enterprise() ->
filelib:is_regular("EMQX_ENTERPRISE").
extra_lib_dir() -> extra_lib_dir() ->
EnterpriseFlag = os:getenv("EMQX_ENTERPRISE"), case is_enterprise() of
case EnterpriseFlag =:= "true" orelse EnterpriseFlag =:= "1" of
true -> "lib-ee"; true -> "lib-ee";
false -> "lib-ce" false -> "lib-ce"
end. end.
@ -61,6 +64,7 @@ test_deps() ->
common_compile_opts() -> common_compile_opts() ->
[ deterministic [ deterministic
, {compile_info, [{emqx_vsn, get_vsn()}]} , {compile_info, [{emqx_vsn, get_vsn()}]}
| [{d, 'EMQX_ENTERPRISE'} || is_enterprise()]
]. ].
prod_compile_opts() -> prod_compile_opts() ->
@ -180,7 +184,9 @@ relx_plugin_apps(ReleaseType) ->
, emqx_sasl , emqx_sasl
, emqx_telemetry , emqx_telemetry
, emqx_modules , emqx_modules
] ++ relx_plugin_apps_per_rel(ReleaseType). ]
++ relx_plugin_apps_per_rel(ReleaseType)
++ relx_plugin_apps_enterprise(is_enterprise()).
relx_plugin_apps_per_rel(cloud) -> relx_plugin_apps_per_rel(cloud) ->
[ emqx_lwm2m [ emqx_lwm2m
@ -197,6 +203,11 @@ relx_plugin_apps_per_rel(cloud) ->
relx_plugin_apps_per_rel(edge) -> relx_plugin_apps_per_rel(edge) ->
[]. [].
relx_plugin_apps_enterprise(true) ->
[list_to_atom(A) || A <- filelib:wildcard("*", "lib-ee"),
filelib:is_dir(filename:join(["lib-ee", A]))];
relx_plugin_apps_enterprise(false) -> [].
relx_overlay(ReleaseType) -> relx_overlay(ReleaseType) ->
[ {mkdir,"log/"} [ {mkdir,"log/"}
, {mkdir,"data/"} , {mkdir,"data/"}

View File

@ -13,7 +13,7 @@ else
DOWNLOAD_URL="https://github.com/emqx/emqx-dashboard-frontend/releases/download/${VERSION}/emqx-dashboard.zip" DOWNLOAD_URL="https://github.com/emqx/emqx-dashboard-frontend/releases/download/${VERSION}/emqx-dashboard.zip"
fi fi
if [ "${EMQX_ENTERPRISE:-}" = 'true' ] || [ "${EMQX_ENTERPRISE:-}" == '1' ]; then if [ -f 'EMQX_ENTERPRISE' ]; then
DASHBOARD_PATH='lib-ee/emqx_dashboard/priv' DASHBOARD_PATH='lib-ee/emqx_dashboard/priv'
else else
DASHBOARD_PATH='lib-ce/emqx_dashboard/priv' DASHBOARD_PATH='lib-ce/emqx_dashboard/priv'