summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-01-22 10:39:57 -0500
committerFred Hebert <mononcqc@ferd.ca>2015-01-22 10:39:57 -0500
commitbca0d1f91d56404a13d9486351aa2dd1fcf0f201 (patch)
tree1d3c9b6b8cbd841b084a0c225c0ec7df3fd7008c
parent488d70d2f249835a61053469dcc6d8dd89a77f96 (diff)
parentd1902404dc5ea3ec6031f1c4fe7ad392acac92ba (diff)
Merge pull request #109 from tsloughter/error_dep_parsing
Error dep parsing
-rw-r--r--src/rebar_prv_clean.erl2
-rw-r--r--src/rebar_prv_install_deps.erl11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl
index 6d14cdb..ccd126b 100644
--- a/src/rebar_prv_clean.erl
+++ b/src/rebar_prv_clean.erl
@@ -69,7 +69,7 @@ clean_apps(State, Apps) ->
C = rebar_config:consult(AppDir),
S = rebar_state:new(State, C, AppDir),
- ?INFO("Cleaning out ~s...~n", [rebar_app_info:name(AppInfo)]),
+ ?INFO("Cleaning out ~s...", [rebar_app_info:name(AppInfo)]),
%% Legacy hook support
rebar_hooks:run_compile_hooks(AppDir, pre_hooks, clean, S),
rebar_erlc_compiler:clean(State, ec_cnv:to_list(rebar_app_info:dir(AppInfo))),
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 2247277..d3eb306 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -102,7 +102,7 @@ do(State) ->
end
catch
%% maybe_fetch will maybe_throw an exception to break out of some loops
- _:Reason ->
+ _:{error, Reason} ->
{error, Reason}
end.
@@ -114,6 +114,8 @@ find_cycles(Apps) ->
end.
-spec format_error(any()) -> iolist().
+format_error({parse_dep, Dep}) ->
+ io_lib:format("Failed parsing dep ~p~n", [Dep]);
format_error({cycles, Cycles}) ->
Prints = [["applications: ",
[io_lib:format("~s ", [Dep]) || Dep <- Cycle],
@@ -325,7 +327,6 @@ handle_dep(State, DepsDir, AppInfo, Locks, Level) ->
AppInfo1 = rebar_app_info:state(AppInfo, S3),
Deps = rebar_state:get(S3, deps, []),
-
%% Update lock level to be the level the dep will have in this dep tree
NewLocks = [{DepName, Source, LockLevel+Level} ||
{DepName, Source, LockLevel} <- rebar_state:get(S3, {locks, default}, [])],
@@ -427,7 +428,10 @@ parse_dep({Name, _Vsn, Source}, {SrcDepsAcc, PkgDepsAcc}, DepsDir, State) when i
parse_dep({Name, Source, Level}, {SrcDepsAcc, PkgDepsAcc}, DepsDir, State) when is_tuple(Source)
, is_integer(Level) ->
Dep = new_dep(DepsDir, Name, [], Source, State),
- {[Dep | SrcDepsAcc], PkgDepsAcc}.
+ {[Dep | SrcDepsAcc], PkgDepsAcc};
+parse_dep(Dep, _, _, _) ->
+ throw(?PRV_ERROR({parse_dep, Dep})).
+
new_dep(DepsDir, Name, Vsn, Source, State) ->
Dir = ec_cnv:to_list(filename:join(DepsDir, Name)),
@@ -439,7 +443,6 @@ new_dep(DepsDir, Name, Vsn, Source, State) ->
end,
C = rebar_config:consult(rebar_app_info:dir(Dep)),
S = rebar_state:new(rebar_state:new(), C, rebar_app_info:dir(Dep)),
-
Overrides = rebar_state:get(State, overrides, []),
ParentOverrides = rebar_state:overrides(State),
Dep1 = rebar_app_info:state(Dep,