diff options
-rw-r--r-- | rebar.config.sample | 2 | ||||
-rw-r--r-- | src/rebar_prv_dialyzer.erl | 33 | ||||
-rw-r--r-- | test/rebar_dialyzer_SUITE.erl | 12 |
3 files changed, 24 insertions, 23 deletions
diff --git a/rebar.config.sample b/rebar.config.sample index 5dcd7de..37f641f 100644 --- a/rebar.config.sample +++ b/rebar.config.sample @@ -99,8 +99,8 @@ {dialyzer, [ {warnings, [underspecs, no_return]}, {get_warnings, true}, + {plt_apps, top_level_deps}, % top_level_deps | all_deps {plt_extra_apps, []}, - {plt_include_all_deps, false}, {plt_location, local}, % local | "/my/file/name" {plt_prefix, "rebar3"}, {base_plt_apps, [stdlib, kernel, crypto]}, diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index 2a20707..0fc1d7d 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -44,28 +44,29 @@ desc() -> "options `dialyzer` in rebar.config:\n" "`warnings` - a list of dialyzer warnings\n" "`get_warnings` - display warnings when altering a PLT file (boolean)\n" - "`plt_extra_apps` - a list of applications to include in the PLT file*\n" - "`plt_include_all_deps` - in addition to the first level dependencies, " - "include all nested dependent applications in the PLT file (boolean), " - "default to `false`\n" + "`plt_apps` - the strategy for determining the applications which included " + "in the PLT file, `top_level_deps` to include just the direct dependencies " + "or `all_deps` to include all nested dependencies*\n" + "`plt_extra_apps` - a list of applications to include in the PLT file**\n" "`plt_location` - the location of the PLT file, `local` to store in the " "profile's base directory (default) or a custom directory.\n" - "`plt_prefix` - the prefix to the PLT file, defaults to \"rebar3\"**\n" + "`plt_prefix` - the prefix to the PLT file, defaults to \"rebar3\"***\n" "`base_plt_apps` - a list of applications to include in the base " - "PLT file***\n" + "PLT file****\n" "`base_plt_location` - the location of base PLT file, `global` to store in " - "$HOME/.cache/rebar3 (default) or a custom directory***\n" + "$HOME/.cache/rebar3 (default) or a custom directory****\n" "`base_plt_prefix` - the prefix to the base PLT file, defaults to " - "\"rebar3\"** ***\n" + "\"rebar3\"*** ****\n" "\n" "For example, to warn on unmatched returns: \n" "{dialyzer, [{warnings, [unmatched_returns]}]}.\n" "\n" - "*The applications in `dialyzer_base_plt_apps` and any `applications` and " - "`included_applications` listed in their .app files will be added to the " - "list.\n" - "**PLT files are named \"<prefix>_<otp_release>_plt\".\n" - "***The base PLT is a PLT containing the core applications often required " + "*The direct dependent applications are listed in `applications` and " + "`included_applications` of their .app files.\n" + "**The applications in `base_plt_apps` will be added to the " + "list. \n" + "***PLT files are named \"<prefix>_<otp_release>_plt\".\n" + "****The base PLT is a PLT containing the core applications often required " "for a project's PLT. One base PLT is created per OTP version and " "stored in `base_plt_location`. A base PLT is used to build project PLTs." "\n". @@ -182,9 +183,9 @@ proj_plt_files(State) -> Apps = rebar_state:project_apps(State), DepApps = lists:flatmap(fun rebar_app_info:applications/1, Apps), DepApps1 = - case get_config(State, plt_include_all_deps, false) of - false -> DepApps; - true -> collect_nested_dependent_apps(DepApps) + case get_config(State, plt_apps, top_level_deps) of + top_level_deps -> DepApps; + all_deps -> collect_nested_dependent_apps(DepApps) end, get_plt_files(BasePltApps ++ PltApps ++ DepApps1, Apps). diff --git a/test/rebar_dialyzer_SUITE.erl b/test/rebar_dialyzer_SUITE.erl index 99d1024..bbdaaff 100644 --- a/test/rebar_dialyzer_SUITE.erl +++ b/test/rebar_dialyzer_SUITE.erl @@ -8,7 +8,7 @@ update_base_plt/1, update_app_plt/1, build_release_plt/1, - plt_include_all_deps_option/1]). + plt_apps_option/1]). -include_lib("common_test/include/ct.hrl"). -include_lib("eunit/include/eunit.hrl"). @@ -39,7 +39,7 @@ init_per_testcase(Testcase, Config) -> rebar_test_utils:init_rebar_state(Config)]. all() -> - [update_base_plt, update_app_plt, build_release_plt, plt_include_all_deps_option]. + [update_base_plt, update_app_plt, build_release_plt, plt_apps_option]. update_base_plt(Config) -> AppDir = ?config(apps, Config), @@ -131,7 +131,7 @@ build_release_plt(Config) -> {ok, PltFiles} = plt_files(Plt), ?assertEqual(ErtsFiles, PltFiles). -plt_include_all_deps_option(Config) -> +plt_apps_option(Config) -> AppDir = ?config(apps, Config), RebarConfig = ?config(rebar_config, Config), Plt = ?config(plt, Config), @@ -166,14 +166,14 @@ plt_include_all_deps_option(Config) -> ]}], RebarConfig), - %% Dialyzer: plt_include_all_deps = false (default) + %% Dialyzer: plt_apps = top_level_deps (default) rebar_test_utils:run_and_check(Config1, RebarConfig1, ["dialyzer"], {ok, [{app, Name3}]}), {ok, PltFiles1} = plt_files(Plt), ?assertEqual([App2, erts], get_apps_from_beam_files(PltFiles1)), - %% Dialyzer: plt_include_all_deps = true - RebarConfig2 = merge_config([{dialyzer, [{plt_include_all_deps, true}]}], + %% Dialyzer: plt_apps = all_deps + RebarConfig2 = merge_config([{dialyzer, [{plt_apps, all_deps}]}], RebarConfig1), rebar_test_utils:run_and_check(Config1, RebarConfig2, ["dialyzer"], {ok, [{app, Name3}]}), |