summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_state.erl3
-rw-r--r--test/rebar_profiles_SUITE.erl2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 577ed23..dd1f43f 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -257,12 +257,15 @@ apply_profiles(State, Profile) when not is_list(Profile) ->
apply_profiles(State, [default]) ->
State;
apply_profiles(State=#state_t{default = Defaults, current_profiles=CurrentProfiles}, Profiles) ->
+ ProvidedProfiles = lists:prefix([default|Profiles], CurrentProfiles),
AppliedProfiles = case Profiles of
%% Head of list global profile is special, only for use by rebar3
%% It does not clash if a user does `rebar3 as global...` but when
%% it is the head we must make sure not to prepend `default`
[global | _] ->
Profiles;
+ _ when ProvidedProfiles ->
+ deduplicate(CurrentProfiles);
_ ->
deduplicate(CurrentProfiles ++ Profiles)
end,
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl
index 6afdc39..ddc3cf1 100644
--- a/test/rebar_profiles_SUITE.erl
+++ b/test/rebar_profiles_SUITE.erl
@@ -211,7 +211,7 @@ implicit_profile_deduplicate_deps(Config) ->
rebar_test_utils:run_and_check(Config, RebarConfig,
["as", "test,bar", "eunit"], {ok, [{app, Name}
,{dep, "a", "1.0.0"}
- ,{dep, "b", "2.0.0"}]}).
+ ,{dep, "b", "1.0.0"}]}).
all_deps_code_paths(Config) ->
AppDir = ?config(apps, Config),