forked from nomasystems/erf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrebar.config.script
82 lines (77 loc) · 2.22 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%%% FIND DTOs
DTOs =
case file:list_dir("_gen/dtos/") of
{ok, Filenames} ->
Filenames;
{error, enoent} ->
[]
end.
DTOMods = lists:map(
fun(File) ->
[DTO | _Extension] = string:split(File, ".erl", trailing),
erlang:list_to_atom(DTO)
end,
DTOs
).
%%% DIALYZER
RawDialyzerConf =
case lists:keyfind(dialyzer, 1, CONFIG) of
false ->
[];
{dialyzer, Dialyzer} ->
Dialyzer
end.
RawDialyzerExcludeMods =
case lists:keyfind(exclude_mods, 1, RawDialyzerConf) of
false ->
[];
{exclude_mods, ExcludeMods} ->
ExcludeMods
end.
DialyzerExcludeMods = RawDialyzerExcludeMods ++ DTOMods.
DialyzerConf =
{dialyzer,
lists:keystore(exclude_mods, 1, RawDialyzerConf, {exclude_mods, DialyzerExcludeMods})}.
%%% XREF
RawXRefIgnores =
case lists:keyfind(xref_ignores, 1, CONFIG) of
false ->
[];
{xref_ignores, Ignores} ->
Ignores
end.
XRefIgnores = {xref_ignores, RawXRefIgnores ++ DTOMods}.
%%% COVER
RawCoverExcludeMods =
case lists:keyfind(cover_excl_mods, 1, CONFIG) of
false ->
[];
{cover_excl_mods, CoverExclude} ->
CoverExclude
end.
CoverExcludeMods = {cover_excl_mods, RawCoverExcludeMods ++ DTOMods}.
%%% GRADUALIZER
RawGradualizerOpts =
case lists:keyfind(gradualizer_opts, 1, CONFIG) of
false ->
[];
{gradualizer_opts, Gradualizer} ->
Gradualizer
end.
RawGradualizerExcludes =
case lists:keyfind(exclude, 1, RawGradualizerOpts) of
false ->
[];
{exclude, Excludes} ->
Excludes
end.
GradualizerExcludes =
RawGradualizerExcludes ++ lists:map(fun(Filename) -> "_gen/dtos/" ++ Filename end, DTOs).
GradualizerOpts =
{gradualizer_opts,
lists:keystore(exclude, 1, RawGradualizerOpts, {exclude, GradualizerExcludes})}.
%%% UPDATE CONFIG
CONFIG1 = lists:keystore(dialyzer, 1, CONFIG, DialyzerConf).
CONFIG2 = lists:keystore(xref_ignores, 1, CONFIG1, XRefIgnores).
CONFIG3 = lists:keystore(cover_excl_mods, 1, CONFIG2, CoverExcludeMods).
lists:keystore(gradualizer_opts, 1, CONFIG3, GradualizerOpts).