Merge pull request #4272 from zmstone/chore-build-remove-env-var-for-ce-ee

chore(build): use only mark file to tell apart ce ee
This commit is contained in:
Zaiming Shi 2021-03-03 11:13:33 +01:00 committed by GitHub
commit bd3bd906ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts
export EMQX_ENTERPRISE=false
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
PROFILE ?= emqx

View File

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

View File

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