forked from emqx/emqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrebar.config.script
22 lines (19 loc) · 975 Bytes
/
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
%%-*- mode: erlang -*-
%% ==============================================================================
%% Relx configs
%% ==============================================================================
Keyfind = fun(K, L) -> {K, V} = lists:keyfind(K, 1, L), V end,
NewRelx =
fun(Name, Profiles) ->
EMQTT = Keyfind(Name, Profiles),
Relx = Keyfind(relx, EMQTT),
{release, {emqtt, Vsn}, Apps} = lists:keyfind(release, 1, Relx),
GitDescribe = lists:last(string:tokens(os:cmd("git describe --tags --always"), "\n")),
Relx1 = lists:keystore(release, 1, Relx, {release, {emqtt, GitDescribe}, Apps}),
[{relx, Relx1}]
end,
Profiles = Keyfind(profiles, CONFIG),
Profiles1 = lists:keystore(emqtt, 1, Profiles, {emqtt, NewRelx(emqtt, Profiles)}),
Profiles2 = lists:keystore(emqtt_pkg, 1, Profiles1, {emqtt_pkg, NewRelx(emqtt_pkg, Profiles1)}),
NewConfig = lists:keystore(profiles, 1, CONFIG, {profiles, Profiles2}),
NewConfig.