Selaa lähdekoodia

Merge pull request #1544 from ferd/tpodowd-issue1416

Issue #1416: Merge erl_files_first separately and avoid sorting.
pull/1545/head
Fred Hebert 8 vuotta sitten
committed by GitHub
vanhempi
commit
ce0d8ee15c
2 muutettua tiedostoa jossa 27 lisäystä ja 2 poistoa
  1. +4
    -0
      src/rebar_opts.erl
  2. +23
    -2
      test/rebar_profiles_SUITE.erl

+ 4
- 0
src/rebar_opts.erl Näytä tiedosto

@ -118,6 +118,10 @@ merge_opt({plugins, _}, NewValue, _OldValue) ->
NewValue;
merge_opt(profiles, NewValue, OldValue) ->
dict:to_list(merge_opts(dict:from_list(NewValue), dict:from_list(OldValue)));
merge_opt(erl_first_files, Value, Value) ->
Value;
merge_opt(erl_first_files, NewValue, OldValue) ->
OldValue ++ NewValue;
merge_opt(mib_first_files, Value, Value) ->
Value;
merge_opt(mib_first_files, NewValue, OldValue) ->

+ 23
- 2
test/rebar_profiles_SUITE.erl Näytä tiedosto

@ -25,7 +25,8 @@
test_profile_erl_opts_order_2/1,
test_profile_erl_opts_order_3/1,
test_profile_erl_opts_order_4/1,
test_profile_erl_opts_order_5/1]).
test_profile_erl_opts_order_5/1,
first_files_exception/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@ -46,7 +47,8 @@ all() ->
test_profile_erl_opts_order_2,
test_profile_erl_opts_order_3,
test_profile_erl_opts_order_4,
test_profile_erl_opts_order_5].
test_profile_erl_opts_order_5,
first_files_exception].
init_per_suite(Config) ->
application:start(meck),
@ -468,6 +470,25 @@ test_profile_erl_opts_order_5(Config) ->
Opt = last_erl_opt(Opts, [warn_export_all, nowarn_export_all], undefined),
warn_export_all = Opt.
first_files_exception(_Config) ->
RebarConfig = [{erl_first_files, ["c","a","b"]},
{mib_first_files, ["c","a","b"]},
{other, ["c","a","b"]},
{profiles,
[{profile2, [{erl_first_files, ["a","e"]},
{mib_first_files, ["a","e"]},
{other, ["a","e"]}
]}]}],
State = rebar_state:new(RebarConfig),
State1 = rebar_state:apply_profiles(State, [profile2]),
%% Combine lists
?assertEqual(["a","b","c","e"], rebar_state:get(State1, other)),
%% there is no specific reason not to dedupe "a" here aside from "this is how it is"
?assertEqual(["c","a","b","a","e"], rebar_state:get(State1, erl_first_files)),
?assertEqual(["c","a","b","a","e"], rebar_state:get(State1, mib_first_files)),
ok.
get_compiled_profile_erl_opts(Profiles, Config) ->
AppDir = ?config(apps, Config),
PStrs = [atom_to_list(P) || P <- Profiles],

Ladataan…
Peruuta
Tallenna