summaryrefslogtreecommitdiff
path: root/src/rebar_prv_compile.erl
diff options
context:
space:
mode:
authorHeinz N. Gies <heinz@licenser.net>2016-02-08 11:15:59 -0500
committerHeinz N. Gies <heinz@licenser.net>2016-02-08 11:15:59 -0500
commit2f563041cb248ba0cac27b92da5dcc3e7be27f80 (patch)
treee27ecaf59cfeb0e6406f1f4ce753842ff52855d5 /src/rebar_prv_compile.erl
parent91c47db27a3c63fc04940c7c72433062dbadf042 (diff)
parent7fab47dfa05754242790a748bbd303ffe9703e5c (diff)
Merge master
Diffstat (limited to 'src/rebar_prv_compile.erl')
-rw-r--r--src/rebar_prv_compile.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 2996aee..30af90b 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -217,6 +217,10 @@ copy(OldAppDir, AppDir, Dir) ->
%% TODO: use ec_file:copy/2 to do this, it preserves timestamps and
%% may prevent recompilation of files in extra dirs
+copy(Source, Source) ->
+ %% allow users to specify a directory in _build as a directory
+ %% containing additional source/tests
+ ok;
copy(Source, Target) ->
%% important to do this so no files are copied onto themselves
%% which truncates them to zero length on some platforms
@@ -243,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.