瀏覽代碼

Only display old version warning once

This uses the env variable as a global store for variables. It's not the
cleanest thing, but it sounded nicer than pdicts.
pull/1207/head
Fred Hebert 9 年之前
父節點
當前提交
71df9bf141
共有 1 個文件被更改,包括 17 次插入4 次删除
  1. +17
    -4
      src/rebar_config.erl

+ 17
- 4
src/rebar_config.erl 查看文件

@ -58,6 +58,9 @@ consult_lock_file(File) ->
[Locks] when is_list(Locks) -> % beta lock file
read_attrs(beta, Locks, []);
[{Vsn, Locks}|Attrs] when is_list(Locks) -> % versioned lock file
%% Because this is the first version of rebar3 to introduce a lock
%% file, all versionned lock files with a different versions have
%% to be newer.
case Vsn of
?CONFIG_VERSION ->
ok;
@ -65,14 +68,24 @@ consult_lock_file(File) ->
%% Make sure the warning below is to be shown whenever a version
%% newer than the current one is being used, as we can't parse
%% all the contents of the lock file properly.
?WARN("Rebar3 detected a lock file from a newer version. "
"It will be loaded in compatibility mode, but important "
"information may be missing or lost. It is recommended to "
"upgrade Rebar3.", [])
warn_vsn_once()
end,
read_attrs(Vsn, Locks, Attrs)
end.
warn_vsn_once() ->
Warn = application:get_env(rebar, warn_config_vsn) =/= {ok, false},
application:set_env(rebar, warn_config_vsn, false),
case Warn of
false -> ok;
true ->
?WARN("Rebar3 detected a lock file from a newer version. "
"It will be loaded in compatibility mode, but important "
"information may be missing or lost. It is recommended to "
"upgrade Rebar3.", [])
end.
write_lock_file(LockFile, Locks) ->
{NewLocks, Attrs} = write_attrs(Locks),
%% Write locks in the beta format, at least until it's been long

Loading…
取消
儲存