-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathrebar.config.script
More file actions
57 lines (53 loc) · 1.63 KB
/
rebar.config.script
File metadata and controls
57 lines (53 loc) · 1.63 KB
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
% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
%
% Only run the EQC checks when EQC is present.
%
% We have a helper tests/install_eqc_mini.sh script to install it ./eqc, so we
% look for it there first, and add that to the code path. Users may have also
% installed it directly into their OTP distribution, which should be fine,
% code:which(eqc) should find that as well.
%
LocalEQC = filename:join([filename:dirname(SCRIPT), "eqc", "ebin"]),
case filelib:is_dir(LocalEQC) of
true -> code:add_patha(LocalEQC);
false -> ok
end,
HaveEQC = code:which(eqc) =/= non_existing,
ErlOpts = if not HaveEQC -> []; true ->
[{d, 'HAVE_EQC'}]
end,
Config1 = case lists:keyfind(erl_opts, 1, CONFIG) of
{erl_opts, Opts} ->
NewOpts = {erl_opts, Opts ++ ErlOpts},
lists:keyreplace(erl_opts, 1, CONFIG, NewOpts);
false ->
CONFIG ++ [{erl_opts, ErlOpts}]
end,
IsRebar2 = case lists:keyfind(rebar, 1, application:loaded_applications()) of
{rebar, _Desc, Vsn} ->
case string:split(Vsn, ".") of
["2" | _] -> true;
_ -> false
end;
false ->
false
end,
case IsRebar2 of
true ->
Config1;
false ->
Config1 ++ [
{plugins, [{pc, "~> 1.15"}]},
case os:type() of
{win32, _} -> {artifacts, ["priv/jiffy.dll"]};
{_, _} -> {artifacts, ["priv/jiffy.so"]}
end,
{provider_hooks, [
{post, [
{compile, {pc, compile}},
{clean, {pc, clean}}
]}
]}
]
end.