Add plugin for passing extra erl_opts flags to deps, and use it for hipe

This fixes #425 in github issue tracker
This commit is contained in:
Paweł Chmielowski 2015-12-16 12:22:15 +01:00
parent 5fd1aa0d04
commit bae333788b
2 changed files with 15 additions and 2 deletions

12
plugins/deps_erl_opts.erl Normal file
View File

@ -0,0 +1,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), []}.

View File

@ -157,10 +157,10 @@ CfgXrefs = lists:flatmap(
ElixirConfig = case lists:keysearch(elixir, 1, Cfg) of
{value, {elixir, true}} ->
[{plugins, [rebar_elixir_compiler, rebar_exunit] },
[{plugins, [deps_erl_opts, rebar_elixir_compiler, rebar_exunit] },
{lib_dirs, ["deps/elixir/lib"]}];
_ ->
[]
[{plugins, [deps_erl_opts]}]
end,
{ok, Cwd} = file:get_cwd(),
@ -181,6 +181,7 @@ AllDeps = case lists:keytake(lager, 1, AllDeps0) of
Config = [{erl_opts, Macros ++ HiPE ++ DebugInfo ++
[{src_dirs, [asn1, src | SrcDirs]}]},
{deps_erl_opts, HiPE},
{sub_dirs, ["rel"]},
{keep_build_info, true},
{ct_extra_params, "-ct_hooks cth_surefire "