Current section
Files
Jump to
Current section
Files
rebar.config.script
%% -*- mode: erlang; -*-
case erlang:function_exported(rebar3, main, 1) of
true ->
%% rebar3
CONFIG;
false ->
%% rebar 2.x or older
%% rebuild deps
Rebar3Deps = proplists:get_value(deps, CONFIG),
Rebar3TestDeps =
proplists:get_value(deps,
proplists:get_value(test,
proplists:get_value(profiles,
CONFIG))),
%% whenever adding a new Hex package dependency, this fun should be
%% updated
HexToRepo = fun(cowboy) -> "https://github.com/ninenines/cowboy.git";
(ranch) -> "https://github.com/ninenines/ranch.git";
(meck) -> "https://github.com/eproxus/meck.git"
end,
ConvertDep =
fun({DepName, {git, Repo, {ref, Tag}}}) ->
{DepName, ".*", {git, Repo, {tag, Tag}}};
({HexDepName, HexDepVersion}) ->
{HexDepName, ".*", {git, HexToRepo(HexDepName), {tag, HexDepVersion}}}
end,
Rebar2Deps = [ ConvertDep(Dep) || Dep <- Rebar3Deps ++ Rebar3TestDeps ],
lists:keystore(deps, 1, CONFIG, {deps, Rebar2Deps})
end.