mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add support for arch-specific hooks
{pre_hooks, [{"linux", compile, "c_src/build_linux.sh"}]}. {post_hooks, [{"linux", compile, "c_src/build_linux.sh clean"}]}.
This commit is contained in:
parent
54259c5475
commit
8de2c84d89
1 changed files with 10 additions and 1 deletions
|
@ -354,8 +354,17 @@ run_modules([Module | Rest], Command, Config, File) ->
|
|||
apply_hooks(Mode, Config, Command, Env) ->
|
||||
Hooks = rebar_config:get_local(Config, Mode, []),
|
||||
lists:foreach(fun apply_hook/1,
|
||||
[{Env, Hook} || Hook <- Hooks, element(1, Hook) =:= Command]).
|
||||
[{Env, Hook} || Hook <- Hooks,
|
||||
element(1, Hook) =:= Command orelse
|
||||
element(2, Hook) =:= Command]).
|
||||
|
||||
apply_hook({Env, {Arch, Command, Hook}}) ->
|
||||
case rebar_utils:is_arch(Arch) of
|
||||
true ->
|
||||
apply_hook({Env, {Command, Hook}});
|
||||
false ->
|
||||
ok
|
||||
end;
|
||||
apply_hook({Env, {Command, Hook}}) ->
|
||||
Msg = lists:flatten(io_lib:format("Command [~p] failed!~n", [Command])),
|
||||
rebar_utils:sh(Hook, [{env, Env}, {abort_on_error, Msg}]).
|
||||
|
|
Loading…
Reference in a new issue