From caf4468f3bbbea75be35e0cf0560990b5db66e7e Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 16 Feb 2016 08:54:46 -0500 Subject: Make lock files future-proof Changes to how hex or packages may work in the future will necessarily bring changes to the format of lock files. This commit adds an optional framing for future lock files of the form: {Version, LockList}. This format is supported such as the LockList is the current lockfile contents, and will never have more information than it currently does. Attributes can be whatever and are currently undefined. Rebar copies will be able to: - Keep using the core locklist (which avoids breaking the last year or so of community libraries using rebar3) - Warn when it runs an outdated copy in comparison to the lock file - Automatically rewrite lock files in the format it supports - Augment or parse files in a version-specific manner. This changes the usage interface slightly, but is backwards *and* forwards compatible. --- src/rebar_prv_lock.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/rebar_prv_lock.erl') diff --git a/src/rebar_prv_lock.erl b/src/rebar_prv_lock.erl index 8578979..cbe8dfe 100644 --- a/src/rebar_prv_lock.erl +++ b/src/rebar_prv_lock.erl @@ -35,8 +35,7 @@ do(State) -> OldLocks = rebar_state:get(State, {locks, default}, []), Locks = lists:keysort(1, build_locks(State)), Dir = rebar_state:dir(State), - file:write_file(filename:join(Dir, ?LOCK_FILE), - io_lib:format("~p.~n", [Locks])), + rebar_config:write_lock_file(filename:join(Dir, ?LOCK_FILE), Locks), State1 = rebar_state:set(State, {locks, default}, Locks), OldLockNames = [element(1,L) || L <- OldLocks], -- cgit v1.1