diff options
author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-12-04 18:29:11 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-12-05 14:17:18 +0100 |
commit | 8de2c84d89acab7702825d4fb784d414225902d7 (patch) | |
tree | 8679481012fca116a8235d21436e17dc001ff0b2 | |
parent | 54259c5475a929cef5aa251183158bd1a5b8b663 (diff) |
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"}]}.
-rw-r--r-- | src/rebar_core.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index e457f1f..56f0aca 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -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}]). |