summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-06-10 08:43:13 -0400
committerFred Hebert <mononcqc@ferd.ca>2016-06-10 08:43:47 -0400
commit71df9bf1411c04e2f7dae7e9f0352180664b9365 (patch)
tree361bb5d36f5c4495400fc6441d04b091337705b0 /src
parent589eaf13e1de55695cea4f34719c22c4b6467734 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_config.erl21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rebar_config.erl b/src/rebar_config.erl
index 828c45d..9e13d46 100644
--- a/src/rebar_config.erl
+++ b/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