summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav V. Kovalev <kovyl2404@gmail.com>2015-06-02 00:30:24 +0300
committerViacheslav Kovalev <kovyl2404@gmail.com>2015-06-26 11:24:02 +0300
commitd734beb850596f831ffd34cb2c6b252bb1ede6a1 (patch)
tree4db820128908485ce2dd59f44e682ded600fc4d0
parent8138bb92b2ffa7b66768341aa3dac950eb481f3d (diff)
Fix dialyzer tests on windows
-rw-r--r--src/rebar_prv_dialyzer.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index 15f1dac..fb0db95 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -72,6 +72,7 @@ short_desc() ->
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
+ maybe_fix_env(),
?INFO("Dialyzer starting, this may take a while...", []),
code:add_pathsa(rebar_state:code_paths(State, all_deps)),
Plt = get_plt(State),
@@ -91,6 +92,14 @@ do(State) ->
rebar_utils:cleanup_code_path(rebar_state:code_paths(State, default))
end.
+%% This is used to workaround dialyzer quirk discussed here
+%% https://github.com/rebar/rebar3/pull/489#issuecomment-107953541
+%% Dialyzer gets default plt location wrong way by peeking HOME environment
+%% variable which usually is not defined on Windows.
+maybe_fix_env() ->
+ {ok, [[HomePath]]} = init:get_argument(home),
+ os:putenv("DIALYZER_PLT", filename:join(HomePath, ".dialyzer_plt")).
+
-spec format_error(any()) -> iolist().
format_error({error_processing_apps, Error}) ->
io_lib:format("Error in dialyzing apps: ~s", [Error]);