From b29c080931db45eb252d3c1e4cd113a57779c8b2 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Tue, 5 Jan 2016 16:55:12 -0800 Subject: warn if the directories `eunit' or `ct' show up in `src_dirs' if these directories actually exist they'll be added to the path ahead of the release/standard distribution directories and they'll break eunit and/or ct execution fixes #950 --- src/rebar_prv_compile.erl | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index d57b82b..30af90b 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -247,6 +247,21 @@ resolve_src_dirs(Opts) -> %% in src_dirs also exist in extra_src_dirs normalize_src_dirs(SrcDirs, ExtraDirs) -> S = lists:usort(SrcDirs), - E = lists:usort(ExtraDirs), - {S, lists:subtract(E, S)}. + E = lists:subtract(lists:usort(ExtraDirs), S), + ok = warn_on_problematic_directories(S ++ E), + {S, E}. + +%% warn when directories called `eunit' and `ct' are added to compile dirs +warn_on_problematic_directories(AllDirs) -> + F = fun(Dir) -> + case is_a_problem(Dir) of + true -> ?WARN("Possible name clash with directory ~p.", [Dir]); + false -> ok + end + end, + lists:foreach(F, AllDirs). + +is_a_problem("eunit") -> true; +is_a_problem("common_test") -> true; +is_a_problem(_) -> false. -- cgit v1.1