-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrebar.config.script
36 lines (36 loc) · 1.83 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
Config = try json:module_info(exports) of
E ->
lists:keystore(erl_opts, 1, CONFIG,
{erl_opts,
case lists:keyfind(erl_opts, 1, CONFIG) of
{_, O} -> [{d, 'HAVE_json_encode_1'}|O];
_ -> [{d, 'HAVE_json_encode_1'}]
end})
catch
_:_ -> CONFIG
end,
case erlang:function_exported(rebar3, main, 1) of
true -> Config;
false ->
case lists:keyfind(deps, 1, Config) of
{_, Deps} ->
lists:keyreplace(deps, 1, Config,
{deps,
lists:map(fun(Dep) when Dep =:= otpbp; Dep =:= emsgpack ->
{Dep,
{git,
"https://github.com/Ledest/" ++ atom_to_list(Dep) ++".git",
{branch, "master"}}};
({Dep, V}) when Dep =:= otpbp orelse Dep =:= emsgpack, is_list(V) ->
{Dep,
{git,
"https://github.com/Ledest/" ++ atom_to_list(Dep) ++".git",
case V of
"~> " ++ _ -> {branch, "master"};
_ -> {tag, V}
end}};
(Dep) -> Dep
end, Deps)});
_ -> Config
end
end.