mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
Improve resolving of system deps
This version is able to search for know alternative names of deps and helps with running tests when using system deps
This commit is contained in:
parent
f2c3fe8ac6
commit
7d58b7a100
1 changed files with 27 additions and 8 deletions
|
@ -17,7 +17,6 @@
|
||||||
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
%%%
|
%%%
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
Vars = case file:consult(filename:join([filename:dirname(SCRIPT),"vars.config"])) of
|
Vars = case file:consult(filename:join([filename:dirname(SCRIPT),"vars.config"])) of
|
||||||
{ok, Terms} ->
|
{ok, Terms} ->
|
||||||
Terms;
|
Terms;
|
||||||
|
@ -205,15 +204,35 @@ fun(DepsList) ->
|
||||||
end, DepsList)
|
end, DepsList)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
DepAlts = fun("esip") -> ["esip", "p1_sip"];
|
||||||
|
("xmpp") -> ["xmpp", "p1_xmpp"];
|
||||||
|
("fast_xml") -> ["fast_xml", "p1_xml"];
|
||||||
|
(Val) -> [Val]
|
||||||
|
end,
|
||||||
|
|
||||||
|
LibDirInt = fun([Dep|Rest], Suffix, F) ->
|
||||||
|
case code:lib_dir(Dep) of
|
||||||
|
{error, _} ->
|
||||||
|
F(Rest, Suffix, F);
|
||||||
|
V -> V ++ Suffix
|
||||||
|
end;
|
||||||
|
([], _, _) ->
|
||||||
|
error
|
||||||
|
end,
|
||||||
|
|
||||||
|
LibDir = fun(Name, Suffix) ->
|
||||||
|
LibDirInt(DepAlts(Name), Suffix, LibDirInt)
|
||||||
|
end,
|
||||||
|
|
||||||
GlobalDepsFilter =
|
GlobalDepsFilter =
|
||||||
fun(Deps) ->
|
fun(Deps) ->
|
||||||
DepNames = lists:map(fun({DepName, _, _}) -> DepName;
|
DepNames = lists:map(fun({DepName, _, _}) -> DepName;
|
||||||
({DepName, _}) -> DepName
|
({DepName, _}) -> DepName
|
||||||
end, Deps),
|
end, Deps),
|
||||||
lists:filtermap(fun(Dep) ->
|
lists:filtermap(fun(Dep) ->
|
||||||
case code:lib_dir(Dep) of
|
case LibDir(atom_to_list(Dep), "") of
|
||||||
{error, _} ->
|
error ->
|
||||||
{true, "Unable to locate dep '" ++ atom_to_list(Dep) ++ "' in system deps."};
|
exit("Unable to locate dep '" ++ atom_to_list(Dep) ++ "' in system deps.");
|
||||||
_ ->
|
_ ->
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -233,9 +252,9 @@ ResolveDepPath = case {SystemDeps, IsRebar3} of
|
||||||
{true, _} ->
|
{true, _} ->
|
||||||
fun("deps/" ++ Rest) ->
|
fun("deps/" ++ Rest) ->
|
||||||
Slash = string:str(Rest, "/"),
|
Slash = string:str(Rest, "/"),
|
||||||
case code:lib_dir(string:sub_string(Rest, 1, Slash -1)) of
|
case LibDir(string:sub_string(Rest, 1, Slash -1), string:sub_string(Rest, Slash)) of
|
||||||
{error, _} -> Rest;
|
error -> Rest;
|
||||||
V -> V ++ string:sub_string(Rest, Slash)
|
V -> V
|
||||||
end;
|
end;
|
||||||
(Path) ->
|
(Path) ->
|
||||||
Path
|
Path
|
||||||
|
@ -258,7 +277,7 @@ ResolveDepPath = case {SystemDeps, IsRebar3} of
|
||||||
CtParams = fun(CompileOpts) ->
|
CtParams = fun(CompileOpts) ->
|
||||||
["-ct_hooks cth_surefire ",
|
["-ct_hooks cth_surefire ",
|
||||||
lists:map(fun({i, IncPath}) ->
|
lists:map(fun({i, IncPath}) ->
|
||||||
[" -include ", filename:join([Cwd, ResolveDepPath(IncPath)])]
|
[" -include ", filename:absname(ResolveDepPath(IncPath), Cwd)]
|
||||||
end, CompileOpts),
|
end, CompileOpts),
|
||||||
TestConfig]
|
TestConfig]
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue