diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar3.erl | 3 | ||||
-rw-r--r-- | src/rebar_prv_dialyzer.erl | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl index 84d7c3e..879378e 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -105,6 +105,9 @@ run_aux(State, RawArgs) -> rebar_state:apply_profiles(State, [list_to_atom(Profile)]) end, + rebar_utils:check_min_otp_version(rebar_state:get(State1, minimum_otp_vsn, undefined)), + rebar_utils:check_blacklisted_otp_versions(rebar_state:get(State1, blacklisted_otp_vsns, undefined)), + State2 = case os:getenv("HEX_CDN") of false -> State1; diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index 2e5728a..834eb98 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -397,7 +397,7 @@ run_dialyzer(State, Opts, Output) -> case proplists:get_bool(get_warnings, Opts) of true -> WarningsList = get_config(State, warnings, []), - Opts2 = [{warnings, WarningsList}, + Opts2 = [{warnings, legacy_warnings(WarningsList)}, {check_plt, false} | Opts], ?DEBUG("Running dialyzer with options: ~p~n", [Opts2]), @@ -412,6 +412,14 @@ run_dialyzer(State, Opts, Output) -> {0, State} end. +legacy_warnings(Warnings) -> + case dialyzer_version() of + TupleVsn when TupleVsn < {2, 8, 0} -> + [Warning || Warning <- Warnings, Warning =/= unknown]; + _ -> + Warnings + end. + format_warnings(Output, Warnings) -> Warnings1 = rebar_dialyzer_format:format_warnings(Warnings), console_warnings(Warnings1), @@ -475,3 +483,16 @@ collect_nested_dependent_apps(App, Seen) -> end end end. + +dialyzer_version() -> + _ = application:load(dialyzer), + {ok, Vsn} = application:get_key(dialyzer, vsn), + case string:tokens(Vsn, ".") of + [Major, Minor] -> + version_tuple(Major, Minor, "0"); + [Major, Minor, Patch | _] -> + version_tuple(Major, Minor, Patch) + end. + +version_tuple(Major, Minor, Patch) -> + {list_to_integer(Major), list_to_integer(Minor), list_to_integer(Patch)}. |