summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-11-01 19:04:53 -0600
committerTristan Sloughter <t@crashfast.com>2015-11-01 19:04:53 -0600
commitf7326f0b9086ff6faec5aae6750ef763860db38f (patch)
treebf18e84a546a491b39a68657d9f5871b1e84a9b7 /src
parentd119cfcf25d7dd449019f65d578304959b3c7c09 (diff)
parentd48f02dbc4f45b7e4d13e4ae847c44aad67dd873 (diff)
Merge pull request #900 from fishcakez/dialyzer-missing
Rebuild PLT when beams no longer exist
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_dialyzer.erl21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index 487e9d1..2e5728a 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -173,7 +173,7 @@ do_update_proj_plt(State, Plt, Output) ->
case read_plt(State, Plt) of
{ok, OldFiles} ->
check_plt(State, Plt, Output, OldFiles, Files);
- {error, no_such_file} ->
+ error ->
build_proj_plt(State, Plt, Output, Files)
end.
@@ -252,14 +252,25 @@ read_plt(_State, Plt) ->
case dialyzer:plt_info(Plt) of
{ok, Info} ->
Files = proplists:get_value(files, Info, []),
- {ok, Files};
- {error, no_such_file} = Error ->
- Error;
+ read_plt_files(Plt, Files);
+ {error, no_such_file} ->
+ error;
{error, read_error} ->
Error = io_lib:format("Could not read the PLT file ~p", [Plt]),
throw({dialyzer_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
+ [] ->
+ {ok, Files};
+ Missing ->
+ ?INFO("Could not find ~p files in ~p...", [length(Missing), Plt]),
+ ?DEBUG("Could not find files: ~p", [Missing]),
+ error
+ end.
+
check_plt(State, Plt, Output, OldList, FilesList) ->
Old = sets:from_list(OldList),
Files = sets:from_list(FilesList),
@@ -337,7 +348,7 @@ update_base_plt(State, BasePlt, Output, BaseFiles) ->
case read_plt(State, BasePlt) of
{ok, OldBaseFiles} ->
check_plt(State, BasePlt, Output, OldBaseFiles, BaseFiles);
- {error, no_such_file} ->
+ error ->
_ = filelib:ensure_dir(BasePlt),
build_plt(State, BasePlt, Output, BaseFiles)
end.