chore: Dynamically get the app that starts by default

This commit is contained in:
Turtle 2021-07-30 12:10:32 +08:00 committed by turtleDeng
parent e2d507cad9
commit ef1b591532
2 changed files with 11 additions and 16 deletions

View File

@ -221,13 +221,8 @@ shutdown(Reason) ->
reboot() -> reboot() ->
lists:foreach(fun application:start/1 , default_started_applications()). lists:foreach(fun application:start/1 , default_started_applications()).
-ifdef(EMQX_ENTERPRISE).
default_started_applications() ->
[gproc, esockd, ranch, cowboy, ekka, quicer, emqx].
-else.
default_started_applications() -> default_started_applications() ->
[gproc, esockd, ranch, cowboy, ekka, quicer, emqx] ++ emqx_feature(). [gproc, esockd, ranch, cowboy, ekka, quicer, emqx] ++ emqx_feature().
-endif.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Internal functions %% Internal functions
@ -239,15 +234,9 @@ reload_config(ConfFile) ->
[application:set_env(App, Par, Val) || {Par, Val} <- Vals] [application:set_env(App, Par, Val) || {Par, Val} <- Vals]
end, Conf). end, Conf).
-ifndef(EMQX_DEP_APPS).
emqx_feature() -> [].
-else.
emqx_feature() -> emqx_feature() ->
[ emqx_resource ?EMQX_DEP_APPS.
, emqx_authn -endif.
, emqx_authz
, emqx_gateway
, emqx_data_bridge
, emqx_rule_engine
, emqx_bridge_mqtt
, emqx_modules
, emqx_management
, emqx_retainer].

View File

@ -133,10 +133,16 @@ test_deps() ->
]. ].
common_compile_opts() -> common_compile_opts() ->
AppNames = list_dir("apps") ++
case is_enterprise() of
true -> list_dir("lib-ee");
false -> []
end,
[ debug_info % alwyas include debug_info [ debug_info % alwyas include debug_info
, {compile_info, [{emqx_vsn, get_vsn()}]} , {compile_info, [{emqx_vsn, get_vsn()}]}
, {d, snk_kind, msg} , {d, snk_kind, msg}
] ++ ] ++
[{d, 'EMQX_DEP_APPS', AppNames -- [emqx]}] ++
[{d, 'EMQX_ENTERPRISE'} || is_enterprise()] ++ [{d, 'EMQX_ENTERPRISE'} || is_enterprise()] ++
[{d, 'EMQX_EXT_SCHEMAS', emqx_ext_schemas()}] ++ [{d, 'EMQX_EXT_SCHEMAS', emqx_ext_schemas()}] ++
[{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1" ]. [{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1" ].