summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-01 21:45:48 -0500
committerTristan Sloughter <t@crashfast.com>2014-11-01 21:45:48 -0500
commit6121f5112426d562759eca58db656f86962168f8 (patch)
treec71ec8fa4cde3de8abb24ff1b8033f03d9d77b8e
parent2dc5f28a7a0e4d2af915c74a6914bfa690976b54 (diff)
reset hooks for project apps so they are only run once
-rw-r--r--src/rebar_prv_compile.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 7c73545..dde5112 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -58,17 +58,21 @@ do(State) ->
end, Deps),
%% Use the project State for building project apps
+ Cwd = rebar_utils:get_cwd(),
+ run_compile_hooks(Cwd, pre_hooks, State1),
+ %% Set hooks to empty so top-level hooks aren't run for each project app
+ State2 = rebar_state:set(rebar_state:set(State1, post_hooks, []), pre_hooks, []),
lists:foreach(fun(AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo),
C = rebar_config:consult(AppDir),
- S = rebar_state:new(State1, C, AppDir),
+ S = rebar_state:new(State2, C, AppDir),
%% Legacy hook support
- %% TODO: for multi-app projects run top-level hooks only once
run_compile_hooks(AppDir, pre_hooks, S),
build(S, AppInfo),
- run_compile_hooks(AppDir, pre_hooks, S)
+ run_compile_hooks(AppDir, post_hooks, S)
end, ProjectApps),
+ run_compile_hooks(Cwd, post_hooks, State1),
{ok, State1}.