diff options
author | Alexander Sedov <asedov@platbox.com> | 2016-10-11 10:36:12 +0300 |
---|---|---|
committer | Alexander Sedov <asedov@platbox.com> | 2016-10-11 10:40:30 +0300 |
commit | 0afb4c4d477b1c1fba54ad3ef086d0697a5faeaa (patch) | |
tree | e80c4512c3fd4e4afd7e2c0274efd079a853b308 /src | |
parent | 6e9503c4f0232d6e8152b56a7037f22843e53959 (diff) |
Made reading sys.configs consistent with OTP specification.
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_file_utils.erl | 13 | ||||
-rw-r--r-- | src/rebar_prv_common_test.erl | 6 | ||||
-rw-r--r-- | src/rebar_prv_shell.erl | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index 437780d..28cc516 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -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)]). diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 8bfa192..e69d33e 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -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), diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index b7febf8..e14ae3a 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -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. |