forked from erlydtl/erlydtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebar.config.script
45 lines (41 loc) · 1.75 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
%% -*- mode: erlang -*-
Patch = fun (Key, Value, Config) ->
case lists:keysearch(Key, 1, Config) of
{value, {_, Org}} ->
lists:keyreplace(Key, 1, Config, {Key, Org ++ Value});
false ->
[{Key, Value}|Config]
end
end,
Merge = fun (NewCfg) ->
PatchCfg =
case os:getenv("EXTRA_CONFIG") of
false ->
NewCfg;
File ->
{ok, ExtraCfg} = file:consult(File),
NewCfg ++ ExtraCfg
end,
lists:foldl(
fun ({K, V}, C) -> Patch(K, V, C) end,
CONFIG, PatchCfg)
end,
application:load(syntax_tools),
case application:get_key(syntax_tools, vsn) of
{ok, Vsn} when "1.7" > Vsn ->
Deps = [{merl, ".*",
{git, "git://github.com/erlydtl/merl.git", "750b09d44425f435ff579a4d28bf5844bb5b4ef1"},
[raw]}],
PreHooks =
[{"(linux|darwin|solaris)", compile, "make -C \"$REBAR_DEPS_DIR/merl\" all -W test"},
{"(freebsd|netbsd|openbsd)", compile, "gmake -C \"$REBAR_DEPS_DIR/merl\" all"},
{"win32", compile, "make -C \"%REBAR_DEPS_DIR%/merl\" all -W test"},
{"(linux|darwin|solaris)", eunit, "make -C \"$REBAR_DEPS_DIR/merl\" test"},
{"(freebsd|netbsd|openbsd)", eunit, "gmake -C \"$REBAR_DEPS_DIR/merl\" test"},
{"win32", eunit, "make -C \"%REBAR_DEPS_DIR%/merl\" test"}],
Merge([{deps, Deps},
{pre_hooks, PreHooks},
{erl_opts, [{d, 'MERL_DEP'}]}]);
_ ->
Merge([])
end.