Browse Source

Made reading sys.configs consistent with OTP specification.

pull/1348/head
Alexander Sedov 8 years ago
parent
commit
0afb4c4d47
3 changed files with 13 additions and 10 deletions
  1. +8
    -5
      src/rebar_file_utils.erl
  2. +3
    -3
      src/rebar_prv_common_test.erl
  3. +2
    -2
      src/rebar_prv_shell.erl

+ 8
- 5
src/rebar_file_utils.erl View File

@ -72,11 +72,14 @@ consult_config(State, Filename) ->
[T] -> T;
[] -> []
end,
SubConfigs = [consult_config(State, Entry ++ ".config") ||
Entry <- Config, is_list(Entry)
],
[Config | lists:merge(SubConfigs)].
lists:flatmap(
fun (SubConfig) when is_list(SubConfig) ->
case consult_config(State, SubConfig) of
[] -> consult_config(State, SubConfig ++ ".config");
X -> X
end;
(Entry) -> [Entry]
end, Config).
format_error({bad_term_file, AppFile, Reason}) ->
io_lib:format("Error reading file ~s: ~s", [AppFile, file:format_error(Reason)]).

+ 3
- 3
src/rebar_prv_common_test.erl View File

@ -218,9 +218,9 @@ select_tests(_, _, _, {error, _} = Error) -> Error;
select_tests(State, ProjectApps, CmdOpts, CfgOpts) ->
%% set application env if sys_config argument is provided
SysConfigs = sys_config_list(CmdOpts, CfgOpts),
Configs = lists:flatmap(fun(Filename) ->
rebar_file_utils:consult_config(State, Filename)
end, SysConfigs),
Configs = lists:map(fun(Filename) ->
rebar_file_utils:consult_config(State, Filename)
end, SysConfigs),
code:add_pathsa(rebar_state:code_paths(State, all_deps)),
[application:load(Application) || Config <- Configs, {Application, _} <- Config],
rebar_utils:reread_config(Configs),

+ 2
- 2
src/rebar_prv_shell.erl View File

@ -331,8 +331,8 @@ reread_config(State) ->
case find_config(State) of
no_config ->
ok;
ConfigList ->
_ = rebar_utils:reread_config(ConfigList),
Config ->
_ = rebar_utils:reread_config([Config]),
ok
end.

Loading…
Cancel
Save