Browse Source

conditionally write lockfile on vsn change

pull/2232/head
Fred Hebert 5 years ago
parent
commit
c9cce688f1
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      src/rebar_config.erl

+ 11
- 2
src/rebar_config.erl View File

@ -114,8 +114,17 @@ warn_vsn_once() ->
%% Only call `write_lock_file/2' if the locks have changed. %% Only call `write_lock_file/2' if the locks have changed.
maybe_write_lock_file(LockFile, Locks, OldLocks) when Locks =/= OldLocks -> maybe_write_lock_file(LockFile, Locks, OldLocks) when Locks =/= OldLocks ->
write_lock_file(LockFile, Locks); write_lock_file(LockFile, Locks);
maybe_write_lock_file(_, _, _) ->
ok.
maybe_write_lock_file(LockFile, Locks, Locks) ->
%% rewrite if the configured format would have changed
Terms = consult_file_(LockFile),
case Terms of
[] ->
ok;
[{?CONFIG_VERSION, FileLocks}|_] when is_list(FileLocks) ->
ok;
_ ->
write_lock_file(LockFile, Locks)
end.
%% @doc Converts the internal format for locks into the multi-version %% @doc Converts the internal format for locks into the multi-version
%% compatible one used within rebar3 lock files. %% compatible one used within rebar3 lock files.

Loading…
Cancel
Save