From f911f8f99c32880a8bdb0fa14464f02cf9e7307e Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 12 Mar 2014 00:42:50 -0400 Subject: [PATCH] Actually run the hooks, not just the plugins --- src/rebar_core.erl | 2 +- src/rebar_deps.erl | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 44b1d56..6fe3cf1 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -28,7 +28,7 @@ -export([process_commands/2, help/2]). --export([execute_pre/5, execute_post/5]). +-export([execute_pre/5, execute_post/5, apply_hooks/4]). -include("rebar.hrl"). diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 14ec3db..4762c0b 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -565,20 +565,30 @@ update_source(Config, Dep) -> true -> ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), %% Check for and get command specific environments - Env = setup_env(Config), + {ok, CWD} = file:get_cwd(), + ok = file:set_cwd(AppDir), + Config1 = rebar_config:new(Config), + + Env = setup_env(Config1), {true, ModuleSetFile} = rebar_app_utils:is_app_dir(AppDir), %% Execute any before_command plugins on this directory - Config1 = rebar_core:execute_pre('update-deps', [], - Config, ModuleSetFile, Env), + Config2 = rebar_core:execute_pre('update-deps', [], + Config1, ModuleSetFile, Env), + + rebar_core:apply_hooks(pre_hooks, Config2, 'update-deps', Env), + require_source_engine(Dep#dep.source), update_source1(AppDir, Dep#dep.source), + rebar_core:apply_hooks(post_hooks, Config2, 'update-deps', Env), + %% Execute any after_command plugins on this directory rebar_core:execute_post('update-deps', [], - Config1, ModuleSetFile, Env), + Config2, ModuleSetFile, Env), + ok = file:set_cwd(CWD), Dep; false -> ?WARN("Skipping update for ~p: "