forked from g-andrade/locus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebar.config.script
59 lines (57 loc) · 3.18 KB
/
rebar.config.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% vim: set ft=erlang:
case erlang:function_exported(rebar3, main, 1) orelse
{deps, lists:keyfind(deps, 1, CONFIG)}
of
true ->
% rebar3
CONFIG;
{deps, false} ->
% no override needed
CONFIG;
{deps, {_, Deps}} ->
%
% rebar 2.x - convert deps to old format
% THIS MAY STOP WORKING AT ANY MOMENT.
% USE AT YOUR OWN RISK.
%
error_logger:warning_msg("~n~n"
"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~n"
"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~n"
"\t*********************************************************************~n"
"\t~n"
"\t[locus] You're **strongly** incentivized to use `rebar3`.~n"
"\tCompatibility with rebar 2 is unmaintained and will be removed in the near future.~n"
"\t~n"
"\t*********************************************************************~n"
"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~n"
"\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~n"),
{_, ErlOpts} = lists:keyfind(erl_opts, 1, CONFIG),
OverriddenErlOpts = ErlOpts -- [warn_missing_spec],
OverriddenSortableDeps =
lists:foldr(
fun ({stacktrace_compat, Version}, Acc) ->
[{1, {stacktrace_compat, ".*", {git, "https://github.com/g-andrade/stacktrace_compat.git",
{tag, Version}}}}
| Acc];
({certifi, Version}, Acc) ->
[{2, {certifi, ".*", {git, "https://github.com/certifi/erlang-certifi.git",
{tag, Version}}}},
%% XXX we don't actually need parse_trans, but certifi imports it
%% from hex.pm, which would make it impossible to build it on rebar 2.
{2, {parse_trans, ".*", {git, "https://github.com/uwiger/parse_trans.git",
{tag, "3.3.0"}}}}
| Acc];
({ssl_verify_fun, Version}, Acc) ->
[{3, {ssl_verify_fun, ".*", {git, "https://github.com/deadtrickster/ssl_verify_fun.erl.git",
{tag, Version}}}}
| Acc];
({Name, Version}, _Acc) ->
MsgErrorIo = io_lib:format("Hex package '~ts', version \"~ts\": missing Git repo",
[Name, Version]),
error(MsgErrorIo)
end,
[], Deps),
OverriddenDeps = [element(2, Pair) || Pair <- lists:keysort(1, OverriddenSortableDeps)],
Config2 = lists:keystore(deps, 1, CONFIG, {deps,OverriddenDeps}),
lists:keystore(erl_opts, 1, Config2, {erl_opts,OverriddenErlOpts})
end.