diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_state.erl | 1 | ||||
-rw-r--r-- | src/rebar_utils.erl | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl index 22e5497..f73370b 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -231,7 +231,6 @@ do_deduplicate([Head | Rest], Acc) -> merge_opts(Profile, NewOpts, OldOpts) -> Opts = merge_opts(NewOpts, OldOpts), - case dict:find(deps, NewOpts) of {ok, Value} -> dict:store({deps, Profile}, Value, Opts); diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index bc2e4ac..76be9a8 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -257,7 +257,20 @@ tup_sort(List) -> tup_umerge([], Olds) -> Olds; tup_umerge([New|News], Olds) -> - lists:reverse(umerge(News, Olds, [], New)). + reverse_deduplicate( umerge(News, Olds, [], New) ). + +reverse_deduplicate(List) -> + lists:reverse( do_deduplicate(lists:reverse(List), []) ). + +do_deduplicate([], Acc) -> + Acc; +do_deduplicate([Value | Rest], Acc) -> + case lists:member(Value, Acc) of + true -> + do_deduplicate(Rest, Acc); + false -> + do_deduplicate(Rest, [Value | Acc]) + end. %% This is equivalent to umerge2_2 in the stdlib, except we use the expanded %% value/key only to compare |