summaryrefslogtreecommitdiff
path: root/src/rebar_utils.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_utils.erl')
-rw-r--r--src/rebar_utils.erl26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 30da523..c7128fc 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -54,6 +54,8 @@
expand_env_variable/3,
get_arch/0,
wordsize/0,
+ deps_to_binary/1,
+ tup_dedup/1,
tup_umerge/2,
tup_sort/1,
tup_find/2,
@@ -236,6 +238,30 @@ erl_opts(Config) ->
%% was enclosed in quotes and might have commas but should not be split.
args_to_tasks(Args) -> new_task(Args, []).
+deps_to_binary([]) ->
+ [];
+deps_to_binary([{Name, _, Source} | T]) ->
+ [{ec_cnv:to_binary(Name), Source} | deps_to_binary(T)];
+deps_to_binary([{Name, Source} | T]) ->
+ [{ec_cnv:to_binary(Name), Source} | deps_to_binary(T)];
+deps_to_binary([Name | T]) ->
+ [ec_cnv:to_binary(Name) | deps_to_binary(T)].
+
+tup_dedup([]) ->
+ [];
+tup_dedup([A]) ->
+ [A];
+tup_dedup([A,B|T]) when element(1, A) =:= element(1, B) ->
+ tup_dedup([A | T]);
+tup_dedup([A,B|T]) when element(1, A) =:= B ->
+ tup_dedup([A | T]);
+tup_dedup([A,B|T]) when A =:= element(1, B) ->
+ tup_dedup([A | T]);
+tup_dedup([A,A|T]) ->
+ [A|tup_dedup(T)];
+tup_dedup([A|T]) ->
+ [A|tup_dedup(T)].
+
%% Sort the list in proplist-order, meaning that `{a,b}' and `{a,c}'
%% both compare as usual, and `a' and `b' do the same, but `a' and `{a,b}' will
%% compare based on the first element of the key, and in order. So the following