diff options
Diffstat (limited to 'src/rebar_packages.erl')
-rw-r--r-- | src/rebar_packages.erl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/rebar_packages.erl b/src/rebar_packages.erl index 7974fda..a0d1a9d 100644 --- a/src/rebar_packages.erl +++ b/src/rebar_packages.erl @@ -2,9 +2,15 @@ -export([get_packages/1]). +-export_type([package/0]). + -include("rebar.hrl"). --spec get_packages(rebar_state:t()) -> {rebar_dict(), rlx_depsolver:t()}. +-type pkg_name() :: binary() | atom(). +-type vsn() :: binary(). +-type package() :: pkg_name() | {pkg_name(), vsn()}. + +-spec get_packages(rebar_state:t()) -> {rebar_dict(), rebar_digraph()}. get_packages(State) -> Home = rebar_utils:home_dir(), RebarDir = rebar_state:get(State, global_rebar_dir, filename:join(Home, ?CONFIG_DIR)), @@ -14,12 +20,12 @@ get_packages(State) -> try {ok, Binary} = file:read_file(PackagesFile), {Dict, Graph} = binary_to_term(Binary), - {Dict, Graph} + {Dict, rebar_digraph:restore_graph(Graph)} catch _:_ -> - ?ERROR("Bad packages index, try to fix with `rebar update`~n", []), - {dict:new(), rlx_depsolver:new_graph()} + ?ERROR("Bad packages index, try to fix with `rebar update`", []), + {dict:new(), digraph:new()} end; false -> - {dict:new(), rlx_depsolver:new_graph()} + {dict:new(), digraph:new()} end. |