浏览代码

more efficient check for existing dep

pull/3/head
Tristan Sloughter 10 年前
父节点
当前提交
3924908f64
共有 2 个文件被更改,包括 17 次插入8 次删除
  1. +3
    -0
      src/rebar_app_utils.erl
  2. +14
    -8
      src/rebar_prv_install_deps.erl

+ 3
- 0
src/rebar_app_utils.erl 查看文件

@ -27,6 +27,7 @@
-module(rebar_app_utils).
-export([find/2,
find/3,
is_app_dir/0, is_app_dir/1,
is_app_src/1,
app_src_to_app/1,
@ -54,9 +55,11 @@ find(Name, Vsn, Apps) ->
andalso rebar_app_info:original_vsn(App) =:= Vsn
end, Apps).
-spec is_app_dir() -> {true, file:name()} | false.
is_app_dir() ->
is_app_dir(rebar_utils:get_cwd()).
-spec is_app_dir(file:name()) -> {true, file:name()} | false.
is_app_dir(Dir) ->
SrcDir = filename:join([Dir, "src"]),
AppSrc = filename:join([SrcDir, "*.app.src"]),

+ 14
- 8
src/rebar_prv_install_deps.erl 查看文件

@ -176,16 +176,22 @@ handle_dep(DepsDir, AppInfo) ->
{AppInfo1, SrcDeps, BinaryDeps}.
-spec maybe_fetch(rebar_app_info:t(), rebar_state:t()) -> ok.
maybe_fetch(AppInfo, State) ->
AppDir = rebar_app_info:dir(AppInfo),
Apps = rebar_app_discover:find_apps([get_deps_dir(State)], all),
case rebar_app_utils:find(rebar_app_info:name(AppInfo), Apps) of
{ok, _} ->
maybe_fetch(AppInfo, _State) ->
AppDir = ec_cnv:to_list(rebar_app_info:dir(AppInfo)),
%Apps = rebar_app_discover:find_apps([get_deps_dir(State)], all),
%case rebar_app_utils:find(rebar_app_info:name(AppInfo), Apps) of
case rebar_app_utils:is_app_dir(filename:absname(AppDir)++"-*") of
{true, _} ->
ok;
_ ->
?INFO("Fetching ~s~n", [rebar_app_info:name(AppInfo)]),
Source = rebar_app_info:source(AppInfo),
rebar_fetch:download_source(AppDir, Source)
case rebar_app_utils:is_app_dir(filename:absname(AppDir)) of
{true, _} ->
ok;
_ ->
?INFO("Fetching ~s~n", [rebar_app_info:name(AppInfo)]),
Source = rebar_app_info:source(AppInfo),
rebar_fetch:download_source(AppDir, Source)
end
end.
-spec parse_deps(binary(), [dep()]) -> {ordsets:ordset(rebar_app_info:t()), [binary_dep()]}.

正在加载...
取消
保存