use the effective deps dir instead of hardcoding "deps"

suggested by @tuncer
This commit is contained in:
YAMAMOTO Takashi 2014-05-30 14:48:15 +09:00
parent ad588a70b7
commit 5e91322e4a
2 changed files with 8 additions and 6 deletions

View file

@ -210,7 +210,7 @@ make_cmd(TestDir, RawLogDir, Config) ->
CodeDirs = [io_lib:format("\"~s\"", [Dir]) || CodeDirs = [io_lib:format("\"~s\"", [Dir]) ||
Dir <- [EbinDir|NonLibCodeDirs]], Dir <- [EbinDir|NonLibCodeDirs]],
CodePathString = string:join(CodeDirs, " "), CodePathString = string:join(CodeDirs, " "),
Cmd = case get_ct_specs(Cwd) of Cmd = case get_ct_specs(Config, Cwd) of
undefined -> undefined ->
?FMT("~s" ?FMT("~s"
" -pa ~s" " -pa ~s"
@ -260,8 +260,8 @@ build_name(Config) ->
get_extra_params(Config) -> get_extra_params(Config) ->
rebar_config:get_local(Config, ct_extra_params, ""). rebar_config:get_local(Config, ct_extra_params, "").
get_ct_specs(Cwd) -> get_ct_specs(Config, Cwd) ->
case collect_glob(Cwd, ".*\.test\.spec\$") of case collect_glob(Config, Cwd, ".*\.test\.spec\$") of
[] -> undefined; [] -> undefined;
[Spec] -> [Spec] ->
" -spec " ++ Spec; " -spec " ++ Spec;
@ -275,7 +275,7 @@ get_cover_config(Config, Cwd) ->
false -> false ->
""; "";
true -> true ->
case collect_glob(Cwd, ".*cover\.spec\$") of case collect_glob(Config, Cwd, ".*cover\.spec\$") of
[] -> [] ->
?DEBUG("No cover spec found: ~s~n", [Cwd]), ?DEBUG("No cover spec found: ~s~n", [Cwd]),
""; "";
@ -287,14 +287,15 @@ get_cover_config(Config, Cwd) ->
end end
end. end.
collect_glob(Cwd, Glob) -> collect_glob(Config, Cwd, Glob) ->
{true, Deps} = rebar_deps:get_deps_dir(Config),
CwdParts = filename:split(Cwd), CwdParts = filename:split(Cwd),
filelib:fold_files(Cwd, Glob, true, fun(F, Acc) -> filelib:fold_files(Cwd, Glob, true, fun(F, Acc) ->
%% Ignore any specs under the deps/ directory. Do this pulling %% Ignore any specs under the deps/ directory. Do this pulling
%% the dirname off the F and then splitting it into a list. %% the dirname off the F and then splitting it into a list.
Parts = filename:split(filename:dirname(F)), Parts = filename:split(filename:dirname(F)),
Parts2 = remove_common_prefix(Parts, CwdParts), Parts2 = remove_common_prefix(Parts, CwdParts),
case lists:member("deps", Parts2) of case lists:member(Deps, Parts2) of
true -> true ->
Acc; % There is a directory named "deps" in path Acc; % There is a directory named "deps" in path
false -> false ->

View file

@ -40,6 +40,7 @@
%% for internal use only %% for internal use only
-export([info/2]). -export([info/2]).
-export([get_deps_dir/1]).
-record(dep, { dir, -record(dep, { dir,
app, app,