diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-08 15:57:50 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-08 15:57:50 -0500 |
commit | d020c0089d932741d9618e790601c23d9dcab3f5 (patch) | |
tree | 63fada6a4f9828b9b6d839848c76cc37e738b3d3 /src/rebar_prv_eunit.erl | |
parent | 963f9754233b53933e7febda350666400f439fdd (diff) | |
parent | b0300f1b2f1c366510463e3a110694e225f69ae3 (diff) |
Merge pull request #251 from talentdeficit/compile_from_build
symlink extra test dirs and compile from there instead of from root project
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r-- | src/rebar_prv_eunit.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 1540471..8763344 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -140,15 +140,22 @@ compile_tests(State, TestApps) -> ec_cnv:to_list(rebar_app_info:out_dir(AppInfo))) end, lists:foreach(F, TestApps), - compile_bare_tests(State, TestApps). + case filelib:is_dir(filename:join([rebar_dir:get_cwd(), "test"])) of + true -> compile_bare_tests(State, TestApps); + false -> ok + end. compile_bare_tests(State, TestApps) -> F = fun(App) -> rebar_app_info:dir(App) == rebar_dir:get_cwd() end, case lists:filter(F, TestApps) of - %% compile just the `test` directory of the base dir - [] -> rebar_erlc_compiler:compile(replace_src_dirs(State), - rebar_dir:get_cwd(), - filename:join([rebar_dir:base_dir(State), "ebin"])); + %% compile and link just the `test` directory of the base dir + [] -> + Source = filename:join([rebar_dir:get_cwd(), "test"]), + Target = filename:join([rebar_dir:base_dir(State), "test"]), + ok = rebar_file_utils:symlink_or_copy(Source, Target), + rebar_erlc_compiler:compile(replace_src_dirs(State), + rebar_dir:base_dir(State), + filename:join([rebar_dir:base_dir(State), "ebin"])); %% already compiled `./test` so do nothing _ -> ok end. |