diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-04-11 17:05:15 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-04-11 17:05:15 -0500 |
commit | 4ee7fef913977add95460544a25e4f8ceb803fb0 (patch) | |
tree | c96db88a0a77c2d0d2df7b89cfd03f1d8d8ab4ae | |
parent | 41b95eb295c2e4c76dbea4c26dee2d73180d5b74 (diff) |
store registry fetched from disk in state
-rw-r--r-- | src/rebar.hrl | 6 | ||||
-rw-r--r-- | src/rebar_prv_install_deps.erl | 5 | ||||
-rw-r--r-- | src/rebar_state.erl | 11 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/rebar.hrl b/src/rebar.hrl index 1f051d7..593738e 100644 --- a/src/rebar.hrl +++ b/src/rebar.hrl @@ -36,6 +36,12 @@ -type rebar_digraph() :: digraph(). -endif. +-ifdef(namespaced_types). +-type rebar_tid() :: ets:tid(). +-else. +-type rebar_tid() :: tid(). +-endif. + -define(GRAPH_VSN, 2). -type v() :: {digraph:vertex(), term()} | 'false'. -type e() :: {digraph:vertex(), digraph:vertex()}. diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 57cd05f..bf20a2e 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -134,7 +134,8 @@ handle_deps(_Profile, State, [], _, _) -> handle_deps(Profile, State0, Deps, Upgrade, Locks) -> %% Read in package index and dep graph {Packages, Graph} = rebar_state:packages(State0), - State = rebar_state:packages(State0, {Packages, Graph}), + Registry = rebar_packages:registry(State0), + State = rebar_state:packages(rebar_state:registry(State0, Registry), {Packages, Graph}), %% Split source deps from pkg deps, needed to keep backwards compatibility DepsDir = rebar_dir:deps_dir(State), {SrcDeps, PkgDeps} = parse_deps(DepsDir, Deps, State, Locks, 0), @@ -573,7 +574,7 @@ not_needs_compile(App) -> andalso rebar_app_info:valid(App). get_package(Dep, State) -> - case rebar_packages:registry(State) of + case rebar_state:registry(State) of {ok, T} -> HighestDepVsn = rebar_packages:find_highest_matching(Dep, "0", T), {Dep, HighestDepVsn}; diff --git a/src/rebar_state.erl b/src/rebar_state.erl index af875d7..3e45ba8 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -31,6 +31,7 @@ apply_overrides/2, packages/1, packages/2, + registry/1, registry/2, resources/1, resources/2, add_resource/2, providers/1, providers/2, add_provider/2]). @@ -54,7 +55,7 @@ all_deps = [] :: [rebar_app_info:t()], packages = undefined :: {rebar_dict(), rebar_digraph()} | undefined, - + registry = undefined :: {ok, rebar_tid()} | error | undefined, overrides = [], resources = [], providers = []}). @@ -311,6 +312,14 @@ packages(#state_t{packages=Packages}) -> packages(State, Packages) -> State#state_t{packages=Packages}. +registry(State=#state_t{registry=undefined}) -> + rebar_packages:registry(State); +registry(#state_t{registry=Registry}) -> + Registry. + +registry(State, Registry) -> + State#state_t{registry=Registry}. + -spec resources(t()) -> rebar_resource:resource(). resources(#state_t{resources=Resources}) -> Resources. |