Przeglądaj źródła

Merge pull request #2232 from ferd/tsloughter-lock-file-writes

only write lock file if locks have changed
pull/2237/head
Fred Hebert 5 lat temu
committed by GitHub
rodzic
commit
c0d016dddd
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 17 dodań i 1 usunięć
  1. +16
    -0
      src/rebar_config.erl
  2. +1
    -1
      src/rebar_prv_lock.erl

+ 16
- 0
src/rebar_config.erl Wyświetl plik

@ -31,6 +31,7 @@
,consult_app_file/1
,consult_file/1
,consult_lock_file/1
,maybe_write_lock_file/3
,write_lock_file/2
,verify_config_format/1
,format_error/1
@ -110,6 +111,21 @@ warn_vsn_once() ->
"upgrade Rebar3.", [])
end.
%% Only call `write_lock_file/2' if the locks have changed.
maybe_write_lock_file(LockFile, Locks, OldLocks) when Locks =/= OldLocks ->
write_lock_file(LockFile, Locks);
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
%% compatible one used within rebar3 lock files.
%% @end

+ 1
- 1
src/rebar_prv_lock.erl Wyświetl plik

@ -35,7 +35,7 @@ do(State) ->
OldLocks = rebar_state:get(State, {locks, default}, []),
Locks = lists:keysort(1, build_locks(State)),
Dir = rebar_state:dir(State),
rebar_config:write_lock_file(filename:join(Dir, ?LOCK_FILE), Locks),
rebar_config:maybe_write_lock_file(filename:join(Dir, ?LOCK_FILE), Locks, OldLocks),
State1 = rebar_state:set(State, {locks, default}, Locks),
OldLockNames = [element(1,L) || L <- OldLocks],

Ładowanie…
Anuluj
Zapisz