summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Fish <james@fishcakez.com>2016-07-11 18:01:33 +0100
committerJames Fish <james@fishcakez.com>2016-07-11 18:01:33 +0100
commit941048dce7b0fab65ee8a07828bbc8c5e2034841 (patch)
treeff8df09d7639bf8d03d839d4c7b5efe2e6625c27 /src
parent403d33830732a6874931afb9c80bff4cb8e327f8 (diff)
Avoid PLT rebuild when files deleted on new dialyzer
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_dialyzer.erl19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index ec9e81a..82d2d07 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/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