anchor.diff:  
   %% Internal functions
   
  -set_plt_location(State) ->
  +get_plt_location(State) ->
       BuildDir = rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR),
  -    DefaultPlt = filename:join([BuildDir, ".rebar.plt"]),
  -    Plt = rebar_state:get(State, dialyzer_plt, DefaultPlt),
  -    rebar_state:set(State, dialyzer_plt, Plt).
  -
  -update_plt(State, Apps, Deps) ->
  +    DefaultPlt = filename:join([BuildDir, default_plt()]),
  +    rebar_state:get(State, dialyzer_plt, DefaultPlt).
  +
  +default_plt() ->
  +    ".rebar3.otp-" ++ otp_version() ++ ".plt".
  +
  +otp_version() ->
  +    Release = erlang:system_info(otp_release),
  +    try otp_version(Release) of
  +        Vsn ->
  +            Vsn
  +    catch
  +        error:_ ->
  +            Release
  +    end.
  +
  +otp_version(Release) ->
  +    File = filename:join([code:root_dir(), "releases", Release, "OTP_VERSION"]),
  +    {ok, Contents} = file:read_file(File),
  +    [Vsn] = binary:split(Contents, [<<$\n>>], [global, trim]),
  +    [_ | _] = unicode:characters_to_list(Vsn).
  +
  +update_proj_plt(State, Plt, Apps) ->
       {Args, _} = rebar_state:command_parsed_args(State),
       case proplists:get_value(update_plt, Args) of
           false ->
               {ok, State};
           _ ->
  -            do_update_plt(State, Apps, Deps)
  -    end.
  -
  -do_update_plt(State, Apps, Deps) ->
  +            do_update_proj_plt(State, Plt, Apps)
  +    end.
  +
  +do_update_proj_plt(State, Plt, Apps) ->
       ?INFO("Updating plt...", []),
  -    Files = get_plt_files(State, Apps, Deps),
  -    case read_plt(State) of
  +    Files = get_plt_files(State, Apps),
  +    case read_plt(State, Plt) of
           {ok, OldFiles} ->
  -            check_plt(State, OldFiles, Files);
  +            check_plt(State, Plt, OldFiles, Files);
           {error, no_such_file} ->
  -            build_plt(State, Files)
  -    end.
  -
  -get_plt_files(State, Apps, Deps) ->
  -    case rebar_state:get(State, dialyzer_plt_apps) of
  -        undefined ->
  -            default_plt_files(Apps, Deps);
  -        PltApps ->
  -            app_names_to_files(PltApps, Apps ++ Deps)
  -    end.
  -
  -default_plt_files(Apps, Deps) ->
  +            build_proj_plt(State, Plt, Files)
  +    end.
  +
  +get_plt_files(State, Apps) ->
  +    PltApps = rebar_state:get(State, dialyzer_plt_apps, []),
       DepApps = lists:flatmap(fun rebar_app_info:applications/1, Apps),
  -    default_plt_files(default_plt_apps() ++ DepApps, Apps, Deps, [], []).
  +    get_plt_files([erts] ++ PltApps ++ DepApps, Apps, [], []).
   
   default_plt_apps() ->
       [erts,
        kernel,
        stdlib].
   
  -default_plt_files([], _, _, _, Files) ->
  +get_plt_files([], _, _, Files) ->
       Files;
  -default_plt_files([AppName | DepApps], Apps, Deps, PltApps, Files) ->
  -    case lists:member(AppName, PltApps) of
  +get_plt_files([AppName | DepApps], Apps, PltApps, Files) ->
  +    case lists:member(AppName, PltApps) orelse app_member(AppName, Apps) of
           true ->
  -            default_plt_files(DepApps, Apps, Deps, PltApps, Files);
  +            get_plt_files(DepApps, Apps, PltApps, Files);
           false ->
  -            {DepApps2, Files2} = app_name_to_info(AppName, Apps, Deps),
  +            {DepApps2, Files2} = app_name_to_info(AppName),
               DepApps3 = DepApps2 ++ DepApps,
               Files3 = Files2 ++ Files,
  -            default_plt_files(DepApps3, Apps, Deps, [AppName | PltApps], Files3)
  -    end.
  -
  -app_name_to_info(AppName, Apps, Deps) ->
  +            get_plt_files(DepApps3, Apps, [AppName | PltApps], Files3)
  +    end.
  +
  +app_member(AppName, Apps) ->
       case rebar_app_utils:find(ec_cnv:to_binary(AppName), Apps) of
  -        {ok, App} ->
  -            % Don't include project app files in plt
  -            {rebar_app_info:applications(App), []};
  +        {ok, _App} ->
  +            true;
           error ->
  -            app_name_to_info(AppName, Deps)
  +            false
       end.
   
   apps_to_files(Apps) ->
       lists:flatmap(fun app_to_files/1, Apps).
   
   app_to_files(App) ->
  -    AppDetails = rebar_app_info:app_details(App),
  -    Modules = proplists:get_value(modules, AppDetails, []),
  -    EbinDir = rebar_app_info:ebin_dir(App),
  -    modules_to_files(Modules, EbinDir).
  +    AppName = ec_cnv:to_atom(rebar_app_info:name(App)),
  +    {_, Files} = app_name_to_info(AppName),
  +    Files.
   
   modules_to_files(Modules, EbinDir) ->
       Ext = code:objfile_extension(),
  
positive.code:             throw({dialyzer_error, Error})
      end.
  
  check_plt(State, OldList, FilesList) ->
      Old = sets:from_list(OldList),
      Files = sets:from_list(FilesList),
      Remove = sets:subtract(Old, Files),
      {ok, State1} = remove_plt(State, sets:to_list(Remove)),
      Check = sets:intersection(Files, Old),
      {ok, State2} = check_plt(State1, sets:to_list(Check)),
      Add = sets:subtract(Files, Old),
      add_plt(State2, sets:to_list(Add)).
  
  remove_plt(State, []) ->
      {ok, State};
  remove_plt(State, Files) ->
      ?INFO("Removing ~b files from plt...", [length(Files)]),
      run_plt(State, plt_remove, Files).
  
  check_plt(State, []) ->
      {ok, State};
  check_plt(State, Files) ->
      ?INFO("Checking ~b files in plt...", [length(Files)]),
      run_plt(State, plt_check, Files).
  
  add_plt(State, []) ->
      {ok, State};
  add_plt(State, Files) ->
      ?INFO("Adding ~b files to plt...", [length(Files)]),
      run_plt(State, plt_add, Files).
  
  run_plt(State, Analysis, Files) ->
      Plt = rebar_state:get(State, dialyzer_plt),
      Opts = [{analysis_type, Analysis},
              {init_plt, Plt},
              {from, byte_code},
              {files, Files}],
      run_dialyzer(State, Opts).
  
  build_plt(State, Files) ->
      Plt = rebar_state:get(State, dialyzer_plt),
      ?INFO("Adding ~b files to plt...", [length(Files)]),
      Opts = [{analysis_type, plt_build},
              {output_plt, Plt},
              {files, Files}],
      run_dialyzer(State, Opts).
  
  succ_typings(State, Apps) ->
      {Args, _} = rebar_state:command_parsed_args(State),
      case proplists:get_value(succ_typings, Args) of
          false ->
              {ok, State};
          _ ->
              do_succ_typings(State, Apps)
      end.
  
  do_succ_typings(State, Apps) ->
      ?INFO("Doing success typing analysis...", []),
      Files = apps_to_files(Apps),
      Plt = rebar_state:get(State, dialyzer_plt),
      Opts = [{analysis_type, succ_typings},
              {from, byte_code},
              {files, Files},
              {plts, [Plt]}],
      run_dialyzer(State, Opts).
  
  run_dialyzer(State, Opts) ->
  
negative.code:     "`dialyzer_warnings` - a list of dialyzer warnings\n"
      "`dialyzer_plt` - the PLT file to use\n"
      "`dialyzer_plt_apps` - a list of applications to include in the PLT file*\n"
      "`dialyzer_base_plt` - the base PLT file to use**\n"
      "`dialyzer_base_plt_dir` - the base PLT directory**\n"
      "`dialyzer_base_plt_apps` - a list of applications to include in the base "
      "PLT file**\n"
      "\n"
      "*If this configuration is not present a selection of applications will be "
      "used based on the `applications` and `included_applications` fields in "
      "the relevant .app files.\n"
      "**The base PLT is a PLT containing the core OTP applications often "
      "required for a project's PLT. One base PLT is created per OTP version and "
      "stored in `dialyzer_base_plt_dir` (defaults to $HOME/.rebar3/). A base "
      "PLT is used to create a project's initial PLT.".
  
  short_desc() ->
      "Run the Dialyzer analyzer on the project.".
  