mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 11:09:55 +00:00
Deprecate fail_on_warning and refactor code
This commit is contained in:
parent
121d8f03f9
commit
055ac99d6f
7 changed files with 52 additions and 50 deletions
|
@ -10,3 +10,9 @@
|
|||
-define(ERROR(Str, Args), rebar_log:log(error, Str, Args)).
|
||||
|
||||
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
|
||||
|
||||
-define(DEPRECATED(Old, New, Opts, When),
|
||||
rebar_utils:deprecated(Old, New, Opts, When)).
|
||||
|
||||
-define(DEPRECATED(Old, New, When),
|
||||
rebar_utils:deprecated(Old, New, When)).
|
||||
|
|
|
@ -69,6 +69,10 @@
|
|||
|
||||
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
|
||||
compile(Config, _AppFile) ->
|
||||
?DEPRECATED(fail_on_warning, warnings_as_errors,
|
||||
rebar_config:get_list(Config, erl_opts, []),
|
||||
"once OTP R15 is released"),
|
||||
|
||||
rebar_base_compiler:run(Config,
|
||||
check_files(rebar_config:get_local(
|
||||
Config, xrl_first_files, [])),
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
%% ===================================================================
|
||||
|
||||
compile(Config, _AppFile) ->
|
||||
?DEPRECATED(fail_on_warning, warnings_as_errors,
|
||||
rebar_config:get_list(Config, lfe_opts, []),
|
||||
"once OTP R15 is released"),
|
||||
|
||||
FirstFiles = rebar_config:get_list(Config, lfe_first_files, []),
|
||||
rebar_base_compiler:run(Config, FirstFiles, "src", ".lfe", "ebin", ".beam",
|
||||
fun compile_lfe/3).
|
||||
|
|
|
@ -182,15 +182,9 @@ 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"
|
||||
>>, []),
|
||||
?DEPRECATED(port_pre_script,
|
||||
{pre_hooks, [{compile, "script"}]},
|
||||
"in a future build of rebar"),
|
||||
case filelib:is_regular(BypassFileName) of
|
||||
false ->
|
||||
?CONSOLE("Running ~s\n", [Script]),
|
||||
|
@ -207,14 +201,9 @@ 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"
|
||||
>>, []),
|
||||
?DEPRECATED(port_cleanup_script,
|
||||
{post_hooks, [{clean, "script"}]},
|
||||
"in a future build of rebar"),
|
||||
?CONSOLE("Running ~s\n", [Script]),
|
||||
{ok, _} = rebar_utils:sh(Script, []),
|
||||
ok
|
||||
|
|
|
@ -56,19 +56,10 @@ execute_post_script(Config, Key) ->
|
|||
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"
|
||||
>>, []).
|
||||
|
||||
deprecated(Key=compile_post_script) ->
|
||||
?DEPRECATED(Key, {post_hooks, [{compile, "script"}]},
|
||||
"in a future build of rebar");
|
||||
deprecated(Key=clean_post_script) ->
|
||||
?DEPRECATED(Key, {post_hooks, [{clean, "script"}]},
|
||||
"in a future build of rebar").
|
||||
|
|
|
@ -56,19 +56,9 @@ execute_pre_script(Config, Key) ->
|
|||
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"
|
||||
>>, []).
|
||||
deprecated(Key=compile_pre_script) ->
|
||||
?DEPRECATED(Key, {pre_hooks, [{compile, "script"}]},
|
||||
"in a future build of rebar");
|
||||
deprecated(Key=clean_pre_script) ->
|
||||
?DEPRECATED(Key, {pre_hooks, [{clean, "script"}]},
|
||||
"in a future build of rebar").
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
escript_foldl/3,
|
||||
find_executable/1,
|
||||
prop_check/3,
|
||||
expand_code_path/0]).
|
||||
expand_code_path/0,
|
||||
deprecated/3, deprecated/4]).
|
||||
|
||||
-include("rebar.hrl").
|
||||
|
||||
|
@ -249,3 +250,20 @@ emulate_escript_foldl(Fun, Acc, File) ->
|
|||
{error, _} = Error ->
|
||||
Error
|
||||
end.
|
||||
|
||||
deprecated(Old, New, Opts, When) ->
|
||||
case lists:member(Old, Opts) of
|
||||
true ->
|
||||
deprecated(Old, New, When);
|
||||
false ->
|
||||
ok
|
||||
end.
|
||||
|
||||
deprecated(Old, New, When) ->
|
||||
io:format(
|
||||
<<
|
||||
"WARNING: option deprecated~n"
|
||||
"Config option '~p' has been deprecated~n"
|
||||
"in favor of '~p'.~n"
|
||||
"'~p' will be removed ~s.~n~n"
|
||||
>>, [Old, New, Old, When]).
|
||||
|
|
Loading…
Reference in a new issue