summaryrefslogtreecommitdiff
path: root/plugins/deps_erl_opts.erl
blob: 72580266441616480f128809d180aba1b03d7bd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
-module(deps_erl_opts).
-export([preprocess/2]).

preprocess(Config, Dirs) ->
    ExtraOpts = rebar_config:get(Config, deps_erl_opts, []),
    Opts = rebar_config:get(Config, erl_opts, []),
    NewOpts = lists:foldl(fun(Opt, Acc) when is_tuple(Opt) ->
                                  lists:keystore(element(1, Opt), 1, Acc, Opt);
                             (Opt, Acc) ->
                                  [Opt | lists:delete(Opt, Acc)]
                          end, Opts, ExtraOpts),
    {ok, rebar_config:set(Config, erl_opts, NewOpts), []}.