浏览代码

Merge pull request #1265 from fishcakez/avoid-rebuild

Avoid PLT rebuild when files deleted on new dialyzer
pull/1266/head
Fred Hebert 8 年前
提交者 GitHub
父节点
当前提交
47380929c4
共有 1 个文件被更改,包括 16 次插入3 次删除
  1. +16
    -3
      src/rebar_prv_dialyzer.erl

+ 16
- 3
src/rebar_prv_dialyzer.erl 查看文件

@ -249,10 +249,15 @@ ebin_files(EbinDir) ->
File <- filelib:wildcard(Wildcard, EbinDir)].
read_plt(_State, Plt) ->
case dialyzer:plt_info(Plt) of
{ok, Info} ->
Files = proplists:get_value(files, Info, []),
Vsn = dialyzer_version(),
case plt_files(Plt) of
{ok, Files} when Vsn < {2, 9, 0} ->
% Before dialyzer-2.9 (OTP 18.3) removing a beam file from the PLT
% that no longer exists would crash. Therefore force a rebuild of
% PLT if any files no longer exist.
read_plt_files(Plt, Files);
{ok, _} = Result when Vsn >= {2, 9, 0} ->
Result;
{error, no_such_file} ->
error;
{error, read_error} ->
@ -260,6 +265,14 @@ read_plt(_State, Plt) ->
throw({dialyzer_error, Error})
end.
plt_files(Plt) ->
case dialyzer:plt_info(Plt) of
{ok, Info} ->
{ok, proplists:get_value(files, Info, [])};
{error, _} = Error ->
Error
end.
%% If any file no longer exists dialyzer will fail when updating the PLT.
read_plt_files(Plt, Files) ->
case [File || File <- Files, not filelib:is_file(File)] of

正在加载...
取消
保存