summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-01-07 16:08:55 -0500
committerFred Hebert <mononcqc@ferd.ca>2016-01-07 16:08:55 -0500
commit99627b161c99dc17fd5614244782424e58e295a2 (patch)
tree56123d50d976cee1d7a0d4ba48687db8ca1ab87b
parent72855b223bce28506282062670080a1919e814d6 (diff)
parentb29c080931db45eb252d3c1e4cd113a57779c8b2 (diff)
Merge pull request #994 from talentdeficit/REBAR-950
warn if the directories `eunit' or `ct' show up in `src_dirs'
-rw-r--r--src/rebar_prv_compile.erl19
1 files 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.