summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-03-15 04:49:12 +0000
committerFred Hebert <mononcqc@ferd.ca>2015-03-15 04:49:12 +0000
commitf35f26fece0bc3843bd4dba9244ae974fd84d9e1 (patch)
tree3f76294db603ef692b516681792c3fae6b2ab04d /src
parentbc98ea22aa15406e4cb05e460b72772d40871f4e (diff)
Implement deps conflicts as errors
The option {deps_error_on_conflict, true} will make it so conflicts in deps being fetched interrupts the operation rather than just display a warning. Defaults to `false'.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_install_deps.erl26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 1c269fb..48402da 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -189,7 +189,7 @@ update_pkg_deps(Profile, Packages, PkgDeps, Graph, Upgrade, Seen, State) ->
{ok, Solution, []} ->
Solution;
{ok, Solution, Discarded} ->
- [warn_skip_pkg(Pkg) || Pkg <- Discarded],
+ [warn_skip_pkg(Pkg, State) || Pkg <- Discarded],
Solution
end,
update_pkg_deps(Profile, S, Packages, Upgrade, Seen, State)
@@ -287,7 +287,7 @@ update_seen_src_dep(AppInfo, Level, SrcDeps, PkgDeps, SrcApps, State, Upgrade, S
%% If seen from lock file don't print warning about skipping
case lists:keymember(Name, 1, BaseLocks) of
false ->
- warn_skip_deps(AppInfo);
+ warn_skip_deps(AppInfo, State);
true ->
ok
end,
@@ -513,13 +513,21 @@ parse_goal(Name, Constraint) ->
fail
end.
-warn_skip_deps(AppInfo) ->
- ?WARN("Skipping ~s (from ~p) as an app of the same name "
+warn_skip_deps(AppInfo, State) ->
+ Msg = "Skipping ~s (from ~p) as an app of the same name "
"has already been fetched~n",
- [rebar_app_info:name(AppInfo),
- rebar_app_info:source(AppInfo)]).
+ Args = [rebar_app_info:name(AppInfo),
+ rebar_app_info:source(AppInfo)],
+ case rebar_state:get(State, deps_error_on_conflict, false) of
+ false -> ?WARN(Msg, Args);
+ true -> ?ERROR(Msg, Args), ?FAIL
+ end.
-warn_skip_pkg({Name, Source}) ->
- ?WARN("Skipping ~s (version ~s from package index) as an app of the same "
+warn_skip_pkg({Name, Source}, State) ->
+ Msg = "Skipping ~s (version ~s from package index) as an app of the same "
"name has already been fetched~n",
- [Name, Source]).
+ Args = [Name, Source],
+ case rebar_state:get(State, deps_error_on_conflict, false) of
+ false -> ?WARN(Msg, Args);
+ true -> ?ERROR(Msg, Args), ?FAIL
+ end.