Browse Source

Avoid backward-compatibility-breaking changes.

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

+ 10
- 8
src/rebar_file_utils.erl View File

@ -72,14 +72,16 @@ consult_config(State, Filename) ->
[T] -> T;
[] -> []
end,
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).
JoinedConfig = lists:flatmap(
fun (SubConfig) when is_list(SubConfig) ->
case lists:suffix(".config", SubConfig) of
false -> consult_config(State, SubConfig ++ ".config");
true -> consult_config(State, SubConfig)
end;
(Entry) -> [Entry]
end, Config),
%% Backwards compatibility
[JoinedConfig].
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:map(fun(Filename) ->
rebar_file_utils:consult_config(State, Filename)
end, SysConfigs),
Configs = lists:flatmap(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;
Config ->
_ = rebar_utils:reread_config([Config]),
ConfigList ->
_ = rebar_utils:reread_config(ConfigList),
ok
end.

Loading…
Cancel
Save