Make sure cached setup_envs are reset

This commit is contained in:
Tuncer Ayaz 2012-06-08 19:34:44 +02:00
parent e185e86bff
commit db78956295
2 changed files with 11 additions and 4 deletions

View file

@ -32,7 +32,7 @@
set/3,
set_global/2, get_global/2,
is_verbose/0, get_jobs/0,
set_env/3, get_env/2,
set_env/3, get_env/2, reset_env/1,
set_skip_dir/2, is_skip_dir/2, reset_skip_dirs/1,
clean_config/2,
set_xconf/3, get_xconf/2, erase_xconf/2, reset_xconf/1]).
@ -136,6 +136,9 @@ set_env(Config, Mod, Env) ->
get_env(Config, Mod) ->
dict:fetch(Mod, Config#config.envs).
reset_env(Config) ->
Config#config{envs = new_env()}.
set_skip_dir(Config, Dir) ->
OldSkipDirs = Config#config.skip_dirs,
NewSkipDirs = case is_skip_dir(Config, Dir) of

View file

@ -218,7 +218,7 @@ process_dir0(Dir, Command, DirSet, Config0, CurrentCodePath,
%% the parent initialized it to
restore_code_path(CurrentCodePath),
%% Return the updated {config, dirset} as our result
%% Return the updated {config, dirset} as result
Res.
remember_cwd_subdir(Cwd, Subdirs) ->
@ -256,7 +256,9 @@ processing_base_dir(Dir) ->
%% process each one we haven't seen yet
%%
process_each([], _Command, Config, _ModuleSetFile, DirSet) ->
{Config, DirSet};
%% reset cached setup_env
Config1 = rebar_config:reset_env(Config),
{Config1, DirSet};
process_each([Dir | Rest], Command, Config, ModuleSetFile, DirSet) ->
case sets:is_element(Dir, DirSet) of
true ->
@ -265,7 +267,9 @@ process_each([Dir | Rest], Command, Config, ModuleSetFile, DirSet) ->
false ->
{Config1, DirSet2} = process_dir(Dir, Config, Command, DirSet),
Config2 = rebar_config:clean_config(Config, Config1),
process_each(Rest, Command, Config2, ModuleSetFile, DirSet2)
%% reset cached setup_env
Config3 = rebar_config:reset_env(Config2),
process_each(Rest, Command, Config3, ModuleSetFile, DirSet2)
end.