summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-06-08 19:34:44 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-07-13 15:22:01 +0200
commitdb789562955b2da8065af809883d919f657ad5d8 (patch)
treedc8c2d9089c45b607add75636cd1f15d0df02e80 /src
parente185e86bff17fa7d093f8b24fcc45069ffde55ae (diff)
Make sure cached setup_envs are reset
Diffstat (limited to 'src')
-rw-r--r--src/rebar_config.erl5
-rw-r--r--src/rebar_core.erl10
2 files changed, 11 insertions, 4 deletions
diff --git a/src/rebar_config.erl b/src/rebar_config.erl
index c2d59b2..7efdf75 100644
--- a/src/rebar_config.erl
+++ b/src/rebar_config.erl
@@ -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
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index b175f50..6d27e6b 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -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.