Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort-as: force an order on multiple profiles #1716

Merged
merged 9 commits into from
Mar 30, 2018
3 changes: 3 additions & 0 deletions src/rebar_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/rebar_profiles_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down