Browse Source

set REBAR_DEPS_DIR in hooks env and run pre_compile hooks before deps compile

pull/16/merge
Tristan Sloughter 10 years ago
parent
commit
e9b58f2775
2 changed files with 5 additions and 4 deletions
  1. +3
    -2
      src/rebar_hooks.erl
  2. +2
    -2
      src/rebar_prv_compile.erl

+ 3
- 2
src/rebar_hooks.erl View File

@ -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).

+ 2
- 2
src/rebar_prv_compile.erl View File

@ -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),

Loading…
Cancel
Save