diff options
Diffstat (limited to 'src/rebar_prv_compile.erl')
-rw-r--r-- | src/rebar_prv_compile.erl | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index 5053e57..a440927 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -32,20 +32,23 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> ProjectApps = rebar_state:project_apps(State), + Providers = rebar_state:providers(State), Deps = rebar_state:deps_to_build(State), Cwd = rebar_dir:get_cwd(), - rebar_hooks:run_compile_hooks(Cwd, pre_hooks, compile, State), + + rebar_hooks:run_all_hooks(Cwd, pre, ?PROVIDER, Providers, 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(), - build_apps(EmptyState, Deps), + build_apps(EmptyState, Providers, Deps), %% Use the project State for building project apps %% Set hooks to empty so top-level hooks aren't run for each project app State2 = rebar_state:set(rebar_state:set(State, post_hooks, []), pre_hooks, []), - ProjectApps1 = build_apps(State2, ProjectApps), - rebar_hooks:run_compile_hooks(Cwd, post_hooks, compile, State), + ProjectApps1 = build_apps(State2, Providers, ProjectApps), + + rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State), {ok, rebar_state:project_apps(State, ProjectApps1)}. @@ -53,10 +56,10 @@ do(State) -> format_error(Reason) -> io_lib:format("~p", [Reason]). -build_apps(State, Apps) -> - [build_app(State, AppInfo) || AppInfo <- Apps]. +build_apps(State, Providers, Apps) -> + [build_app(State, Providers, AppInfo) || AppInfo <- Apps]. -build_app(State, AppInfo) -> +build_app(State, Providers, AppInfo) -> AppDir = rebar_app_info:dir(AppInfo), OutDir = rebar_app_info:out_dir(AppInfo), @@ -71,9 +74,10 @@ build_app(State, AppInfo) -> end, %% Legacy hook support - rebar_hooks:run_compile_hooks(AppDir, pre_hooks, compile, S), + + rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, S), AppInfo1 = compile(S, AppInfo), - rebar_hooks:run_compile_hooks(AppDir, post_hooks, compile, S), + rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, S), true = code:add_patha(rebar_app_info:ebin_dir(AppInfo1)), AppInfo1. |