summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-22 19:36:49 -0600
committerTristan Sloughter <t@crashfast.com>2014-11-22 19:37:24 -0600
commite9b58f2775704226b514e967097e902a232081f3 (patch)
tree088c5a99b15e589575ec7d3f52d2c2e787cf2299 /src
parent6c0b3f87c0d79ef8b885c006ec1a32a4af84a5dd (diff)
set REBAR_DEPS_DIR in hooks env and run pre_compile hooks before deps compile
Diffstat (limited to 'src')
-rw-r--r--src/rebar_hooks.erl5
-rw-r--r--src/rebar_prv_compile.erl4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/rebar_hooks.erl b/src/rebar_hooks.erl
index 2599d8e..3e6d533 100644
--- a/src/rebar_hooks.erl
+++ b/src/rebar_hooks.erl
@@ -4,10 +4,11 @@
run_compile_hooks(Dir, Type, Command, State) ->
Hooks = rebar_state:get(State, Type, []),
+ Env = [{"REBAR_DEPS_DIR", rebar_prv_install_deps:get_deps_dir(State)}],
lists:foreach(fun({_, C, _}=Hook) when C =:= Command ->
- apply_hook(Dir, [], Hook);
+ apply_hook(Dir, Env, Hook);
({C, _}=Hook) when C =:= Command ->
- apply_hook(Dir, [], Hook);
+ apply_hook(Dir, Env, Hook);
(_) ->
continue
end, Hooks).
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index b53742d..893fd76 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -43,6 +43,8 @@ do(State) ->
ProjectApps = rebar_state:project_apps(State1),
Deps = rebar_state:get(State1, deps_to_build, []),
+ Cwd = rebar_utils:get_cwd(),
+ rebar_hooks:run_compile_hooks(Cwd, pre_hooks, compile, State1),
%% Need to allow global config vars used on deps
%% Right now no way to differeniate and just give deps a new state
@@ -51,8 +53,6 @@ do(State) ->
build_apps(EmptyState1, Deps),
%% Use the project State for building project apps
- Cwd = rebar_utils:get_cwd(),
- rebar_hooks:run_compile_hooks(Cwd, pre_hooks, compile, 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, []),
build_apps(State2, ProjectApps),