Sfoglia il codice sorgente

Merge pull request #213 from talentdeficit/eunit_fix

preserve state when compiling directories with a `rebar.config`
pull/218/head
Fred Hebert 10 anni fa
parent
commit
768cfccda5
1 ha cambiato i file con 4 aggiunte e 5 eliminazioni
  1. +4
    -5
      src/rebar_prv_eunit.erl

+ 4
- 5
src/rebar_prv_eunit.erl Vedi File

@ -127,28 +127,27 @@ set_verbose(Opts) ->
end. end.
compile_tests(State, TestApps) -> compile_tests(State, TestApps) ->
State1 = replace_src_dirs(State),
F = fun(AppInfo) -> F = fun(AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo), AppDir = rebar_app_info:dir(AppInfo),
S = case rebar_app_info:state(AppInfo) of S = case rebar_app_info:state(AppInfo) of
undefined -> undefined ->
C = rebar_config:consult(AppDir), C = rebar_config:consult(AppDir),
rebar_state:new(State1, C, AppDir);
rebar_state:new(State, C, AppDir);
AppState -> AppState ->
AppState AppState
end, end,
ok = rebar_erlc_compiler:compile(S,
ok = rebar_erlc_compiler:compile(replace_src_dirs(S),
ec_cnv:to_list(rebar_app_info:dir(AppInfo)), ec_cnv:to_list(rebar_app_info:dir(AppInfo)),
ec_cnv:to_list(rebar_app_info:out_dir(AppInfo))) ec_cnv:to_list(rebar_app_info:out_dir(AppInfo)))
end, end,
lists:foreach(F, TestApps), lists:foreach(F, TestApps),
compile_bare_tests(State1, TestApps).
compile_bare_tests(State, TestApps).
compile_bare_tests(State, TestApps) -> compile_bare_tests(State, TestApps) ->
F = fun(App) -> rebar_app_info:dir(App) == rebar_dir:get_cwd() end, F = fun(App) -> rebar_app_info:dir(App) == rebar_dir:get_cwd() end,
case lists:filter(F, TestApps) of case lists:filter(F, TestApps) of
%% compile just the `test` directory of the base dir %% compile just the `test` directory of the base dir
[] -> rebar_erlc_compiler:compile(State,
[] -> rebar_erlc_compiler:compile(replace_src_dirs(State),
rebar_dir:get_cwd(), rebar_dir:get_cwd(),
rebar_dir:base_dir(State)); rebar_dir:base_dir(State));
%% already compiled `./test` so do nothing %% already compiled `./test` so do nothing

Caricamento…
Annulla
Salva