From 30d1cdb31bbcc573cf3f31e67fdf0c1140b731fc Mon Sep 17 00:00:00 2001 From: Tim Watson Date: Tue, 6 Sep 2011 09:51:38 +0100 Subject: Fix config handling in root_dir Avoid overwriting custom config (passed with -C) when we are processing the base_dir in rebar_core. --- src/rebar_core.erl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 5030f06..832bb32 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -102,7 +102,7 @@ process_dir(Dir, ParentConfig, Command, DirSet) -> true -> ?DEBUG("Entering ~s\n", [Dir]), ok = file:set_cwd(Dir), - Config = rebar_config:new(ParentConfig), + Config = maybe_load_local_config(Dir, ParentConfig), %% Save the current code path and then update it with %% lib_dirs. Children inherit parents code path, but we @@ -184,7 +184,18 @@ process_dir(Dir, ParentConfig, Command, DirSet) -> DirSet4 end. +maybe_load_local_config(Dir, ParentConfig) -> + %% We need to ensure we don't overwrite custom + %% config when we are dealing with base_dir. + case processing_base_dir(Dir) of + true -> + ParentConfig; + false -> + rebar_config:new(ParentConfig) + end. +processing_base_dir(Dir) -> + Dir == rebar_config:get_global(base_dir, undefined). %% %% Given a list of directories and a set of previously processed directories, -- cgit v1.1