Skip to content

Commit

Permalink
Merge pull request #2937 from esl/load_only/nksip
Browse files Browse the repository at this point in the history
Tag nksip apps as load-only for relx
  • Loading branch information
chrzaszcz authored Nov 17, 2020
2 parents bd3779b + 79f5ff0 commit f526546
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ all: rel
clean:
-rm -rf asngen
-rm -rf _build
-rm configure.out
-rm rel/configure.vars.config
-rm rel/vars.config
-rm rel/vars-toml.config
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/dynamic_modules.erl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ start(#{node := Node}, Domain, Mod, Args) ->
start(Node, Domain, Mod, Args);
start(Node, Domain, Mod, Args) ->
Cookie = escalus_ct:get_config(ejabberd_cookie),
case escalus_rpc:call(Node, gen_mod, start_module, [Domain, Mod, Args], 5000, Cookie) of
case escalus_rpc:call(Node, gen_mod, start_module, [Domain, Mod, Args], 15000, Cookie) of
{badrpc, Reason} ->
ct:fail("Cannot start module ~p reason ~p", [Mod, Reason]);
R -> R
Expand Down
21 changes: 17 additions & 4 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,30 @@ fun() ->
end
end,

RequiredApps = fun() -> [mongooseim, inets, tools, compiler] end,
FirstApps = [kernel, lager],
RequiredApps = [mongooseim, inets, tools, compiler],
OptionalApps = [{nksip, [nkservice, nkpacket, nklib]}],

EnvApps = GetEnvApps(),

PrepareApp =
fun(App) ->
case lists:keyfind(App, 1, OptionalApps) of
false ->
[App];
{App, DepsOfApp} ->
lists:map(fun(V) -> {V, load} end, [App | DepsOfApp])
end
end,

SetupIncludedApps =
fun(Config, EnvApps) ->
RelxCfg = proplists:get_value(relx, Config),
{release, Desc, _Apps} = lists:keyfind(release, 1, RelxCfg),
EnvAppsToInclude = [ list_to_atom(App) || App <- string:tokens(EnvApps, " \n\r") ],
AppsToIncludeIn = RequiredApps() ++ DevAppsToInclude() ++ EnvAppsToInclude,
AppsToInclude = ordsets:to_list(ordsets:from_list(AppsToIncludeIn)),
NewReleaseCfg = {release, Desc, AppsToInclude},
AppsToIncludeIn = lists:usort(RequiredApps ++ DevAppsToInclude() ++ EnvAppsToInclude),
Apps = lists:subtract(AppsToIncludeIn, FirstApps),
NewReleaseCfg = {release, Desc, FirstApps ++ lists:flatmap(PrepareApp, Apps)},
NewRelxCfg = lists:keyreplace(release, 1, RelxCfg, NewReleaseCfg),
lists:keyreplace(relx, 1, Config, {relx, NewRelxCfg})
end,
Expand Down
2 changes: 1 addition & 1 deletion src/jingle_sip/mod_jingle_sip.erl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ start(Host, Opts) ->
ok.

start_nksip_service_or_error(Opts) ->
application:ensure_all_started(nksip),
{ok, _} = application:ensure_all_started(nksip),
ListenPort = gen_mod:get_opt(listen_port, Opts, 5600),
NkSipBasicOpts = #{sip_listen => "sip:all:" ++ integer_to_list(ListenPort),
callback => jingle_sip_callbacks,
Expand Down

0 comments on commit f526546

Please sign in to comment.