Deprecate xrl_opts/yrl_opts fail_on_warning opt

This commit is contained in:
Tuncer Ayaz 2011-06-08 19:44:57 +02:00
parent ca3368a6b4
commit fbd2778c04
3 changed files with 18 additions and 19 deletions

View file

@ -11,8 +11,8 @@
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))). -define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
-define(DEPRECATED(Old, New, Opts, When), -define(DEPRECATED(Key, Old, New, Opts, When),
rebar_utils:deprecated(Old, New, Opts, When)). rebar_utils:deprecated(Key, Old, New, Opts, When)).
-define(DEPRECATED(Old, New, When), -define(DEPRECATED(Key, Old, New, When),
rebar_utils:deprecated(Old, New, When)). rebar_utils:deprecated(Key, Old, New, When)).

View file

@ -70,13 +70,12 @@
-spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'. -spec compile(Config::rebar_config:config(), AppFile::file:filename()) -> 'ok'.
compile(Config, _AppFile) -> compile(Config, _AppFile) ->
%% TODO: enable as soon as OTP patch has been accepted ?DEPRECATED(xrl_opts, fail_on_warning, warnings_as_errors,
%% ?DEPRECATED(fail_on_warning, warnings_as_errors, rebar_config:get_list(Config, xrl_opts, []),
%% rebar_config:get_list(Config, xrl_opts, []), "once R14B04 is released"),
%% "once R15 is released"), ?DEPRECATED(yrl_opts, fail_on_warning, warnings_as_errors,
%% ?DEPRECATED(fail_on_warning, warnings_as_errors, rebar_config:get_list(Config, yrl_opts, []),
%% rebar_config:get_list(Config, yrl_opts, []), "once R14B04 is released"),
%% "once R15 is released"),
rebar_base_compiler:run(Config, rebar_base_compiler:run(Config,
check_files(rebar_config:get_local( check_files(rebar_config:get_local(
@ -299,7 +298,7 @@ compile_xrl_yrl(Source, Target, Opts, Mod) ->
{ok, _, []} -> {ok, _, []} ->
ok; ok;
{ok, _, _Warnings} -> {ok, _, _Warnings} ->
%% TODO: remove once R15 is released %% TODO: remove once R14B04 is released
case lists:member(fail_on_warning, Opts) of case lists:member(fail_on_warning, Opts) of
true -> true ->
?FAIL; ?FAIL;

View file

@ -41,7 +41,7 @@
find_executable/1, find_executable/1,
prop_check/3, prop_check/3,
expand_code_path/0, expand_code_path/0,
deprecated/3, deprecated/4]). deprecated/4, deprecated/5]).
-include("rebar.hrl"). -include("rebar.hrl").
@ -261,19 +261,19 @@ emulate_escript_foldl(Fun, Acc, File) ->
Error Error
end. end.
deprecated(Old, New, Opts, When) -> deprecated(Key, Old, New, Opts, When) ->
case lists:member(Old, Opts) of case lists:member(Old, Opts) of
true -> true ->
deprecated(Old, New, When); deprecated(Key, Old, New, When);
false -> false ->
ok ok
end. end.
deprecated(Old, New, When) -> deprecated(Key, Old, New, When) ->
io:format( io:format(
<< <<
"WARNING: option deprecated~n" "WARNING: deprecated ~p option used~n"
"Config option '~p' has been deprecated~n" "Option '~p' has been deprecated~n"
"in favor of '~p'.~n" "in favor of '~p'.~n"
"'~p' will be removed ~s.~n~n" "'~p' will be removed ~s.~n~n"
>>, [Old, New, Old, When]). >>, [Key, Old, New, Old, When]).