summaryrefslogtreecommitdiff
path: root/src/rebar_prv_clean.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-04-04 09:59:16 -0500
committerTristan Sloughter <t@crashfast.com>2015-04-04 20:36:52 -0500
commit459ff732a3e06b060517152f7b5e2fa65f6680e7 (patch)
tree8779fcfb9f1775c8c0c4a2d8346f824cdefc6ae4 /src/rebar_prv_clean.erl
parentd95da874cd9831f238e0c91c74b32ff4549dba59 (diff)
install dep plugins & run provider hooks the same as shell hooks
Diffstat (limited to 'src/rebar_prv_clean.erl')
-rw-r--r--src/rebar_prv_clean.erl15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl
index 0da286b..5bc1552 100644
--- a/src/rebar_prv_clean.erl
+++ b/src/rebar_prv_clean.erl
@@ -32,6 +32,7 @@ init(State) ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
+ Providers = rebar_state:providers(State),
ProjectApps = rebar_state:project_apps(State),
{all, All} = handle_args(State),
@@ -46,12 +47,12 @@ do(State) ->
%% Need to allow global config vars used on deps
%% Right now no way to differeniate and just give deps a new state
EmptyState = rebar_state:new(),
- clean_apps(EmptyState, DepApps),
+ clean_apps(EmptyState, Providers, DepApps),
Cwd = rebar_dir:get_cwd(),
- rebar_hooks:run_compile_hooks(Cwd, pre_hooks, clean, State),
- clean_apps(State, ProjectApps),
- rebar_hooks:run_compile_hooks(Cwd, post_hooks, clean, State),
+ rebar_hooks:run_all_hooks(Cwd, pre, clean, Providers, State),
+ clean_apps(State, Providers, ProjectApps),
+ rebar_hooks:run_all_hooks(Cwd, post, clean, Providers, State),
{ok, State}.
@@ -63,7 +64,7 @@ format_error(Reason) ->
%% Internal functions
%% ===================================================================
-clean_apps(State, Apps) ->
+clean_apps(State, Providers, Apps) ->
lists:foreach(fun(AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo),
C = rebar_config:consult(AppDir),
@@ -71,9 +72,9 @@ clean_apps(State, Apps) ->
?INFO("Cleaning out ~s...", [rebar_app_info:name(AppInfo)]),
%% Legacy hook support
- rebar_hooks:run_compile_hooks(AppDir, pre_hooks, clean, S),
+ rebar_hooks:run_all_hooks(AppDir, pre, clean, Providers, S),
rebar_erlc_compiler:clean(State, rebar_app_info:out_dir(AppInfo)),
- rebar_hooks:run_compile_hooks(AppDir, post_hooks, clean, S)
+ rebar_hooks:run_all_hooks(AppDir, post, clean, Providers, S)
end, Apps).
handle_args(State) ->