diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_install_deps.erl | 26 | ||||
-rw-r--r-- | src/rebar_prv_packages.erl | 10 | ||||
-rw-r--r-- | src/rebar_prv_upgrade.erl | 3 |
3 files changed, 25 insertions, 14 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 2d725a4..ca9344b 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -98,6 +98,8 @@ do(State) -> end. -spec format_error(any()) -> iolist(). +format_error({dep_app_not_found, AppDir, AppName}) -> + io_lib:format("Dependency failure: Application ~s not found at the top level of directory ~s", [AppName, AppDir]); format_error({load_registry_fail, Dep}) -> io_lib:format("Error loading registry to resolve version of ~s. Try fixing by running 'rebar3 update'", [Dep]); format_error({bad_constraint, Name, Constraint}) -> @@ -358,16 +360,20 @@ fetch_app(AppInfo, AppDir, State) -> %% So this is the first time for newly downloaded apps that its .app/.app.src data can %% be read in an parsed. update_app_info(AppDir, AppInfo) -> - {ok, Found} = rebar_app_info:discover(AppDir), - AppDetails = rebar_app_info:app_details(Found), - Vsn = rebar_app_info:original_vsn(Found), - Applications = proplists:get_value(applications, AppDetails, []), - IncludedApplications = proplists:get_value(included_applications, AppDetails, []), - AppInfo1 = rebar_app_info:original_vsn(rebar_app_info:applications( - rebar_app_info:app_details(AppInfo, AppDetails), - IncludedApplications++Applications), Vsn), - AppInfo2 = copy_app_info(AppInfo, AppInfo1), - rebar_app_info:valid(AppInfo2, undefined). + case rebar_app_info:discover(AppDir) of + {ok, Found} -> + AppDetails = rebar_app_info:app_details(Found), + Vsn = rebar_app_info:original_vsn(Found), + Applications = proplists:get_value(applications, AppDetails, []), + IncludedApplications = proplists:get_value(included_applications, AppDetails, []), + AppInfo1 = rebar_app_info:original_vsn(rebar_app_info:applications( + rebar_app_info:app_details(AppInfo, AppDetails), + IncludedApplications++Applications), Vsn), + AppInfo2 = copy_app_info(AppInfo, AppInfo1), + rebar_app_info:valid(AppInfo2, undefined); + not_found -> + throw(?PRV_ERROR({dep_app_not_found, AppDir, rebar_app_info:name(AppInfo)})) + end. copy_app_info(OldAppInfo, NewAppInfo) -> Deps = rebar_app_info:deps(OldAppInfo), diff --git a/src/rebar_prv_packages.erl b/src/rebar_prv_packages.erl index f5d9e38..5b8ea66 100644 --- a/src/rebar_prv_packages.erl +++ b/src/rebar_prv_packages.erl @@ -35,8 +35,12 @@ format_error(load_registry_fail) -> "Failed to load package regsitry. Try running 'rebar3 update' to fix". print_packages() -> - SortedPkgs = ets:foldl(fun({{Pkg, Vsn}, _}, Acc) -> - orddict:append_list(Pkg, [Vsn], Acc) + SortedPkgs = ets:foldl(fun({package_index_version, _}, Acc) -> + Acc; + ({Pkg, Vsns}, Acc) -> + orddict:store(Pkg, Vsns, Acc); + (_, Acc) -> + Acc end, orddict:new(), ?PACKAGE_TABLE), orddict:map(fun(Name, Vsns) -> @@ -45,7 +49,7 @@ print_packages() -> ,ec_semver:parse(B)) end, Vsns), VsnStr = join(SortedVsns, <<", ">>), - io:format("~s:~n Versions: ~s~n~n", [Name, VsnStr]) + ?CONSOLE("~s:~n Versions: ~s~n", [Name, VsnStr]) end, SortedPkgs). -spec join([binary()], binary()) -> binary(). diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl index 7385cfe..97d1953 100644 --- a/src/rebar_prv_upgrade.erl +++ b/src/rebar_prv_upgrade.erl @@ -100,7 +100,8 @@ prepare_locks([Name|Names], Deps, Locks, Unlocks) -> {_, _, 0} = Lock -> case rebar_utils:tup_find(AtomName, Deps) of false -> - ?PRV_ERROR({unknown_dependency, Name}); + ?WARN("Dependency ~s has been removed and will not be upgraded", [Name]), + prepare_locks(Names, Deps, Locks, Unlocks); Dep -> {Source, NewLocks, NewUnlocks} = prepare_lock(Dep, Lock, Locks), prepare_locks(Names, Deps, NewLocks, |