From 8835296c7afed5c4abff86f00c71fe3363f8ca6d Mon Sep 17 00:00:00 2001 From: William Yang Date: Mon, 1 Aug 2022 15:09:41 +0200 Subject: [PATCH] ci(rel): intro. rel_otp_apps.eterm --- rebar.config.erl | 21 +++++++-------------- scripts/emqx_rel_otp_app_overwrite.escript | 22 +++++----------------- scripts/rel_otp_apps.eterm | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 31 deletions(-) create mode 100644 scripts/rel_otp_apps.eterm diff --git a/rebar.config.erl b/rebar.config.erl index c94f80c18..e0ee9b891 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -246,21 +246,10 @@ overlay_vars_pkg(pkg) -> ]. relx_apps(ReleaseType) -> - [ kernel - , sasl - , crypto - , public_key - , asn1 - , syntax_tools - , ssl - , os_mon - , inets - , compiler - , runtime_tools - , redbug + relx_otp_apps() ++ + [ redbug , cuttlefish , emqx - , {mnesia, load} , {ekka, load} , {emqx_plugin_libs, load} , observer_cli @@ -271,9 +260,13 @@ relx_apps(ReleaseType) -> ++ relx_apps_per_rel(ReleaseType) ++ [{N, load} || N <- relx_plugin_apps(ReleaseType)]. +relx_otp_apps() -> + {ok, [Apps]} = file:consult("scripts/rel_otp_apps.eterm"), + true = is_list(Apps), + Apps. + relx_apps_per_rel(cloud) -> [ luerl - , xmerl | [{observer, load} || is_app(observer)] ]; relx_apps_per_rel(edge) -> diff --git a/scripts/emqx_rel_otp_app_overwrite.escript b/scripts/emqx_rel_otp_app_overwrite.escript index 52c6bb70e..5eace01ff 100755 --- a/scripts/emqx_rel_otp_app_overwrite.escript +++ b/scripts/emqx_rel_otp_app_overwrite.escript @@ -39,21 +39,9 @@ rel_file("emqx-edge", Dir, RelVsn)-> rel_file(Profile, Dir, RelVsn)-> filename:join([Dir, RelVsn, Profile++".rel"]). - -%% Couldn't find a good way to get this list dynamicly. otp_apps() -> - [ kernel - , stdlib - , sasl - , crypto - , public_key - , asn1 - , syntax_tools - , ssl - , os_mon - , inets - , compiler - , runtime_tools - , mnesia - , xmerl - ]. + {ok, [Apps]} = file:consult("scripts/rel_otp_apps.eterm"), + true = is_list(Apps), + lists:map(fun(App) when is_atom(App) -> App; + ({App, _}) -> App %% handle like {mnesia, load} + end, Apps). diff --git a/scripts/rel_otp_apps.eterm b/scripts/rel_otp_apps.eterm new file mode 100644 index 000000000..4999bbffa --- /dev/null +++ b/scripts/rel_otp_apps.eterm @@ -0,0 +1,16 @@ +%% Single source of truth of list otp apps that we use +[ kernel +, stdlib +, sasl +, crypto +, public_key +, asn1 +, syntax_tools +, ssl +, os_mon +, inets +, compiler +, runtime_tools +, {mnesia, load} +, xmerl +].