-
Notifications
You must be signed in to change notification settings - Fork 7
/
rebar.config.script
41 lines (34 loc) · 1.35 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
NO_ASN1 = false =/= os:getenv("OTC_NO_ASN1"),
NO_DIA = false =/= os:getenv("OTC_NO_DIA"),
io:format("Disable ASN.1: ~p~n", [NO_ASN1]),
io:format("Disable Diameter dicts: ~p~n", [NO_DIA]),
Remove_from_plugins =
fun(Key, Config0) ->
case lists:keytake(plugins, 1, Config0) of
{value, {plugins, Plugins0}, Config1} ->
Plugins = lists:keydelete(Key, 1, Plugins0),
[{plugins, Plugins}|Config1];
false ->
Config0
end
end,
Remove_from_provider_hooks =
fun(Key, Config0) ->
case lists:keytake(provider_hooks, 1, Config0) of
{value, {provider_hooks, Hooks0}, Config1} ->
Hooks = [{K, [C || {_, {T, _}} = C <- Hs, Key =/= T]}
|| {K, Hs} <- Hooks0],
[{provider_hooks, Hooks}|Config1];
false ->
Config0
end
end,
Remove_from_config =
fun ({Plugin, HookName}, Config0) ->
Config1 = Remove_from_plugins(Plugin, Config0),
Config2 = Remove_from_provider_hooks(HookName, Config1),
Config2
end,
DisabledPlugins = [{provider_asn1, asn} || NO_ASN1]
++ [{rebar3_diameter_compiler, diameter} || NO_DIA],
lists:foldl(Remove_from_config, CONFIG, DisabledPlugins).