Deprecate old hooks

This commit is contained in:
Tuncer Ayaz 2011-02-23 19:45:44 +01:00
parent bc98a4820e
commit 4ceb9e07a3
4 changed files with 53 additions and 20 deletions

View file

@ -8,18 +8,6 @@
%% Additional library directories to add to the code path
{lib_dirs, []}.
%% Command to run before compiling
{compile_pre_script, "./script.sh"}.
%% Command to run after compiling
{compile_post_script, "./script.sh"}.
%% Command to run before cleaning
{clean_pre_script, "./script.sh"}.
%% Command to run after cleaning
{clean_post_script, "./script.sh"}.
%% == Erlang Compiler ==
%% Erlang files to compile before the rest. Rebar automatically compiles
@ -54,14 +42,6 @@
%% more info. Default is `[]'
{port_envs, []}.
%% Tuple which specifies a pre-compilation script to run, and a filename that
%% exists as a result of the script running.
{port_pre_script, {"script.sh", "skipfile"}}.
%% String that specifies a script to run during cleanup. Use this to remove
%% files/directories created by port_pre_script.
{port_cleanup_script, "cleanup.sh"}.
%% Custom name of the port driver .so file. Defaults to `<Application>_drv.so'.
{so_name, "driver.so"}.

View file

@ -182,6 +182,15 @@ run_precompile_hook(Config, Env) ->
undefined ->
ok;
{Script, BypassFileName} ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'port_pre_script' has been deprecated "
"in favor of ~n{pre_hooks, [{compile, \"script\"}]}."
"~nskipfile support has also been removed. Add skipfile"
" logic to the~nscript instead.~nFuture builds of rebar"
" will remove the option 'port_pre_script'.~n~n"
>>, []),
case filelib:is_regular(BypassFileName) of
false ->
?CONSOLE("Running ~s\n", [Script]),
@ -198,6 +207,14 @@ run_cleanup_hook(Config) ->
undefined ->
ok;
Script ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'port_pre_script' has been deprecated "
"in favor of ~n{post_hooks, [{clean, \"script\"}]}."
"~nFuture builds of rebar will remove the option "
"'port_pre_script'.~n~n"
>>, []),
?CONSOLE("Running ~s\n", [Script]),
{ok, _} = rebar_utils:sh(Script, []),
ok

View file

@ -51,6 +51,24 @@ execute_post_script(Config, Key) ->
undefined ->
ok;
Script ->
deprecated(Key),
{ok, _} = rebar_utils:sh(Script, []),
ok
end.
deprecated(compile_post_script) ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'compile_post_script' has been deprecated in favor"
" of ~noption {post_hooks, [{compile, \"script\"}]}.~nFuture builds "
"of rebar will remove the option 'compile_post_script'.~n~n"
>>, []);
deprecated(clean_post_script) ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'clean_post_script' has been deprecated in favor"
" of ~noption {post_hooks, [{clean, \"script\"}]}.~nFuture builds "
"of rebar will remove the option 'clean_post_script'.~n~n"
>>, []).

View file

@ -51,6 +51,24 @@ execute_pre_script(Config, Key) ->
undefined ->
ok;
Script ->
deprecated(Key),
{ok, _} = rebar_utils:sh(Script, []),
ok
end.
deprecated(compile_pre_script) ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'compile_pre_script' has been deprecated in favor"
" of ~n{pre_hooks, [{compile, \"script\"}]}.~nFuture builds of"
" rebar will remove the option 'compile_pre_script'.~n~n"
>>, []);
deprecated(clean_pre_script) ->
?CONSOLE(
<<
"WARNING: option deprecated~n"
"Config option 'clean_pre_script' has been deprecated in favor"
" of ~n{pre_hooks, [{clean, \"script\"}]}.~nFuture builds of"
" rebar will remove the option 'clean_pre_script'.~n~n"
>>, []).