From b944acc2042fe94e99d0f1dbb4b64a1a0a5d0b0a Mon Sep 17 00:00:00 2001 From: "Viacheslav V. Kovalev" Date: Tue, 2 Jun 2015 00:30:24 +0300 Subject: Fix dialyzer tests on windows --- src/rebar_prv_dialyzer.erl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/rebar_prv_dialyzer.erl') 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]); -- cgit v1.1 From 9e3b361095a9c108ef5f463846c8c97ce7fc57b9 Mon Sep 17 00:00:00 2001 From: "Viacheslav V. Kovalev" Date: Tue, 2 Jun 2015 00:30:24 +0300 Subject: Fix dialyzer tests on windows --- src/rebar_prv_dialyzer.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rebar_prv_dialyzer.erl') diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index fb0db95..af0bae3 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -389,7 +389,7 @@ run_dialyzer(State, Opts, Output) -> {check_plt, false} | Opts], ?DEBUG("Running dialyzer with options: ~p~n", [Opts2]), - _ = dialyzer:run(Opts2), + dialyzer:run(Opts2), {0, State} end. -- cgit v1.1 From 44272e23b641a016b74edf0cb9849b0656e8f726 Mon Sep 17 00:00:00 2001 From: "Viacheslav V. Kovalev" Date: Fri, 26 Jun 2015 22:35:39 +0300 Subject: Some fixes after review --- src/rebar_prv_dialyzer.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/rebar_prv_dialyzer.erl') diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index af0bae3..1cf7b71 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -97,8 +97,7 @@ do(State) -> %% 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")). + os:putenv("DIALYZER_PLT", filename:join(rebar_dir:home_dir(), ".dialyzer_plt")). -spec format_error(any()) -> iolist(). format_error({error_processing_apps, Error}) -> -- cgit v1.1