summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_state.erl7
-rw-r--r--src/rebar_utils.erl15
2 files changed, 5 insertions, 17 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index f73370b..c2e479d 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -207,7 +207,8 @@ apply_profiles(State, Profile) when not is_list(Profile) ->
apply_profiles(State, [Profile]);
apply_profiles(State, [default]) ->
State;
-apply_profiles(State=#state_t{opts=Opts, current_profiles=CurrentProfiles}, Profiles) ->
+apply_profiles(State=#state_t{default = Defaults, current_profiles=CurrentProfiles}, Profiles) ->
+ AppliedProfiles = deduplicate(CurrentProfiles ++ Profiles),
ConfigProfiles = rebar_state:get(State, profiles, []),
NewOpts =
lists:foldl(fun(default, OptsAcc) ->
@@ -215,8 +216,8 @@ apply_profiles(State=#state_t{opts=Opts, current_profiles=CurrentProfiles}, Prof
(Profile, OptsAcc) ->
ProfileOpts = dict:from_list(proplists:get_value(Profile, ConfigProfiles, [])),
merge_opts(Profile, ProfileOpts, OptsAcc)
- end, Opts, Profiles),
- State#state_t{current_profiles = deduplicate(CurrentProfiles ++ Profiles), opts=NewOpts}.
+ end, Defaults, AppliedProfiles),
+ State#state_t{current_profiles = AppliedProfiles, opts=NewOpts}.
deduplicate(Profiles) ->
do_deduplicate(lists:reverse(Profiles), []).
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 76be9a8..004ed35 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -257,20 +257,7 @@ tup_sort(List) ->
tup_umerge([], Olds) ->
Olds;
tup_umerge([New|News], Olds) ->
- 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.
+ lists:reverse( umerge(News, Olds, [], New) ).
%% This is equivalent to umerge2_2 in the stdlib, except we use the expanded
%% value/key only to compare