summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl9
-rw-r--r--src/rebar_prv_install_deps.erl26
2 files changed, 25 insertions, 10 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index 63cf703..0799313 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -48,7 +48,9 @@ merge_deps(AppInfo, State) ->
State1 = lists:foldl(fun(Profile, StateAcc) ->
AppProfDeps = rebar_state:get(AppState, {deps, Profile}, []),
TopLevelProfDeps = rebar_state:get(StateAcc, {deps, Profile}, []),
- ProfDeps2 = lists:keymerge(1, TopLevelProfDeps, AppProfDeps),
+ ProfDeps2 = dedup(lists:keymerge(1,
+ lists:keysort(1, TopLevelProfDeps),
+ lists:keysort(1, AppProfDeps))),
rebar_state:set(StateAcc, {deps, Profile}, ProfDeps2)
end, State, lists:reverse(CurrentProfiles)),
@@ -166,3 +168,8 @@ create_app_info(AppDir, AppFile) ->
_ ->
error
end.
+
+dedup([]) -> [];
+dedup([A]) -> [A];
+dedup([H,H|T]) -> dedup([H|T]);
+dedup([H|T]) -> [H|dedup(T)].
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.