summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2016-02-11 10:54:14 -0600
committerTristan Sloughter <t@crashfast.com>2016-02-11 10:54:14 -0600
commitb8a590cf192181170d5fdab40652340917ba3905 (patch)
tree4b3b0789bbd72683256b79838f43495b2336e152
parent7fab47dfa05754242790a748bbd303ffe9703e5c (diff)
parentedd032c5f5f1ded195298de67a81d8264c802e6b (diff)
Merge pull request #1048 from fauxsoup/master
Add secondary hook for rebar_prv_compile
-rw-r--r--src/rebar_prv_compile.erl21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 30af90b..effc763 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -13,6 +13,8 @@
-include("rebar.hrl").
-define(PROVIDER, compile).
+-define(ERLC_HOOK, erlc_compile).
+-define(APP_HOOK, app_compile).
-define(DEPS, [lock]).
%% ===================================================================
@@ -116,12 +118,17 @@ compile(State, Providers, AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo),
AppInfo1 = rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, AppInfo, State),
- rebar_erlc_compiler:compile(AppInfo1),
- case rebar_otp_app:compile(State, AppInfo1) of
- {ok, AppInfo2} ->
- AppInfo3 = rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo2, State),
- has_all_artifacts(AppInfo3),
- AppInfo3;
+ AppInfo2 = rebar_hooks:run_all_hooks(AppDir, pre, ?ERLC_HOOK, Providers, AppInfo1, State),
+ rebar_erlc_compiler:compile(AppInfo2),
+ AppInfo3 = rebar_hooks:run_all_hooks(AppDir, post, ?ERLC_HOOK, Providers, AppInfo2, State),
+
+ AppInfo4 = rebar_hooks:run_all_hooks(AppDir, pre, ?APP_HOOK, Providers, AppInfo3, State),
+ case rebar_otp_app:compile(State, AppInfo4) of
+ {ok, AppInfo5} ->
+ AppInfo6 = rebar_hooks:run_all_hooks(AppDir, post, ?APP_HOOK, Providers, AppInfo5, State),
+ AppInfo7 = rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo6, State),
+ has_all_artifacts(AppInfo5),
+ AppInfo7;
Error ->
throw(Error)
end.
@@ -143,7 +150,7 @@ paths_for_apps([App|Rest], Acc) ->
Paths = [filename:join([rebar_app_info:out_dir(App), Dir]) || Dir <- ["ebin"|ExtraDirs]],
FilteredPaths = lists:filter(fun ec_file:is_dir/1, Paths),
paths_for_apps(Rest, Acc ++ FilteredPaths).
-
+
paths_for_extras(State, Apps) ->
F = fun(App) -> rebar_app_info:dir(App) == rebar_state:dir(State) end,
%% check that this app hasn't already been dealt with