diff options
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r-- | src/rebar_utils.erl | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index eafcf0e..bb05597 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -46,6 +46,8 @@ expand_env_variable/3, vcs_vsn/2, get_deprecated_global/3, + get_deprecated_list/4, get_deprecated_list/5, + get_deprecated_local/4, get_deprecated_local/5, delayed_halt/1]). -include("rebar.hrl"). @@ -235,9 +237,12 @@ vcs_vsn_1(Vcs, Dir) -> end. get_deprecated_global(OldOpt, NewOpt, When) -> - case rebar_config:get_global(NewOpt, undefined) of + get_deprecated_global(OldOpt, NewOpt, undefined, When). + +get_deprecated_global(OldOpt, NewOpt, Default, When) -> + case rebar_config:get_global(NewOpt, Default) of undefined -> - case rebar_config:get_global(OldOpt, undefined) of + case rebar_config:get_global(OldOpt, Default) of undefined -> undefined; Old -> @@ -248,6 +253,21 @@ get_deprecated_global(OldOpt, NewOpt, When) -> New end. + +get_deprecated_list(Config, OldOpt, NewOpt, When) -> + get_deprecated_list(Config, OldOpt, NewOpt, undefined, When). + +get_deprecated_list(Config, OldOpt, NewOpt, Default, When) -> + get_deprecated_3(fun rebar_config:get_list/3, + Config, OldOpt, NewOpt, Default, When). + +get_deprecated_local(Config, OldOpt, NewOpt, When) -> + get_deprecated_local(Config, OldOpt, NewOpt, undefined, When). + +get_deprecated_local(Config, OldOpt, NewOpt, Default, When) -> + get_deprecated_3(fun rebar_config:get_local/3, + Config, OldOpt, NewOpt, Default, When). + deprecated(Old, New, Opts, When) when is_list(Opts) -> case lists:member(Old, Opts) of true -> @@ -287,6 +307,20 @@ delayed_halt(Code) -> %% Internal functions %% ==================================================================== +get_deprecated_3(Get, Config, OldOpt, NewOpt, Default, When) -> + case Get(Config, NewOpt, Default) of + Default -> + case Get(Config, OldOpt, Default) of + Default -> + Default; + Old -> + deprecated(OldOpt, NewOpt, When), + Old + end; + New -> + New + end. + %% We do the shell variable substitution ourselves on Windows and hope that the %% command doesn't use any other shell magic. patch_on_windows(Cmd, Env) -> |