-
Notifications
You must be signed in to change notification settings - Fork 8
/
rebar.config.script
100 lines (91 loc) · 2.71 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
%% -*- mode:erlang -*-
IsCentos6 =
fun() ->
case file:read_file("/etc/centos-release") of
{ok, <<"CentOS release 6", _/binary >>} ->
true;
_ ->
false
end
end,
IsWin32 =
fun() ->
win32 =:= element(1, os:type())
end,
IsDarwin =
fun() ->
{unix, darwin} =:= os:type()
end,
CanBuildDocs =
fun() ->
"true" =:= os:getenv("CAN_BUILD_DOCS", "true")
end,
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.111"}}},
IsQuicSupp = not (IsCentos6() orelse IsWin32() orelse IsDarwin() orelse
false =/= os:getenv("BUILD_WITHOUT_QUIC")
),
CopyDocsSteps =
case CanBuildDocs() of
true ->
[ {mkdir, "doc"}
, {copy, "_build/lee_doc/html/", "doc/html"}
, {copy, "_build/lee_doc/man/", "doc/man"}
];
false ->
[]
end,
Profiles =
{profiles,
[ {escript, []}
, {test,
[{deps, [ {proper, "1.3.0"}
]}]}
, {emqttb,
[{relx, [ {release, {emqttb, git}, [ kernel
, stdlib
, syntax_tools
, xmerl
, mnesia
, emqtt
, gun
, cowlib
, lee
, system_monitor
| [ quicer || IsQuicSupp ]
] }
, {overlay_vars_values, [ {runner_root_dir, "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)"}
, {runner_escript_dir, "$RUNNER_ROOT_DIR/escript"}
]}
, {overlay, [ {mkdir, "bin"}
, {mkdir, "escript"}
, {copy, "_build/emqttb/bin", "escript"}
, {copy, "bin/emqttb","bin/emqttb"}
, {template,"bin/emqttb","bin/emqttb"}
| CopyDocsSteps
]}
, {dev_mode, false}
, {include_src, false}
, {include_erts, true}
, {extended_start_script, false}
, {generate_start_script, false}
, {sys_config, false}
, {vm_args, false}
]}
]}
]},
ExtraDeps =
fun(C) ->
{deps, Deps0} = lists:keyfind(deps, 1, C),
Deps = Deps0 ++
[ Quicer || IsQuicSupp ],
lists:keystore(deps, 1, C, {deps, Deps})
end,
NewConfig =
[ {escript_incl_apps,
[emqttb, gproc |
[ quicer || IsQuicSupp ]
]}
, Profiles
| ExtraDeps(CONFIG)],
%io:format("New Config: ~p~n", [NewConfig]),
NewConfig.