anchor.diff:      Apps = rebar_state:project_apps(State),
       get_plt_files(BasePltApps, Apps).
   
  -update_base_plt(State, BasePlt, BaseFiles) ->
  -    ?INFO("Updating base plt...", []),
  +update_base_plt(State, BasePlt, Output, BaseFiles) ->
       case read_plt(State, BasePlt) of
           {ok, OldBaseFiles} ->
  -            check_plt(State, BasePlt, OldBaseFiles, BaseFiles);
  +            check_plt(State, BasePlt, Output, OldBaseFiles, BaseFiles);
           {error, no_such_file} ->
               _ = filelib:ensure_dir(BasePlt),
  -            build_plt(State, BasePlt, BaseFiles)
  -    end.
  -
  -build_plt(State, Plt, Files) ->
  +            build_plt(State, BasePlt, Output, BaseFiles)
  +    end.
  +
  +build_plt(State, Plt, Output, Files) ->
       ?INFO("Adding ~b files to ~p...", [length(Files), Plt]),
       GetWarnings = rebar_state:get(State, dialyzer_plt_warnings, false),
       Opts = [{analysis_type, plt_build},
               {get_warnings, GetWarnings},
               {output_plt, Plt},
               {files, Files}],
  -    run_dialyzer(State, Opts).
  -
  -succ_typings(State, Plt) ->
  +    run_dialyzer(State, Opts, Output).
  +
  +succ_typings(State, Plt, Output) ->
       {Args, _} = rebar_state:command_parsed_args(State),
       case proplists:get_value(succ_typings, Args) of
           false ->
               {0, State};
           _ ->
               Apps = rebar_state:project_apps(State),
  -            succ_typings(State, Plt, Apps)
  -    end.
  -
  -succ_typings(State, Plt, Apps) ->
  +            succ_typings(State, Plt, Output, Apps)
  +    end.
  +
  +succ_typings(State, Plt, Output, Apps) ->
       ?INFO("Doing success typing analysis...", []),
       {Files, Warnings} = apps_to_files(Apps),
  -    Warnings2 = format_warnings(Warnings),
  +    Warnings2 = format_warnings(Output, Warnings),
       ?INFO("Analyzing ~b files with ~p...", [length(Files), Plt]),
       Opts = [{analysis_type, succ_typings},
               {get_warnings, true},
               {from, byte_code},
               {files, Files},
               {init_plt, Plt}],
  -    {Warnings3, State2} = run_dialyzer(State, Opts),
  +    {Warnings3, State2} = run_dialyzer(State, Opts, Output),
       {Warnings2 + Warnings3, State2}.
   
   apps_to_files(Apps) ->
  
positive.code:                      {check_plt, false} |
                       Opts],
              ?DEBUG("Running dialyzer with options: ~p~n", [Opts2]),
              Warnings = format_warnings(dialyzer:run(Opts2)),
              {Warnings, State};
          false ->
              Opts2 = [{warnings, no_warnings()},
  
negative.code:     rebar_utils:otp_release() ++ ".plt".
  
  do(State, Plt) ->
      Output = get_output_file(State),
      {PltWarnings, State1} = update_proj_plt(State, Plt, Output),
      {Warnings, State2} = succ_typings(State1, Plt, Output),
      case PltWarnings + Warnings of
          0 ->
              {ok, State2};
          TotalWarnings ->
              ?INFO("Warnings written to ~s", [Output]),
              throw({dialyzer_warnings, TotalWarnings})
      end.
  
  get_output_file(State) ->
      BaseDir = rebar_dir:base_dir(State),
      Output = filename:join(BaseDir, default_output_file()),
      case file:open(Output, [write]) of
          {ok, File} ->
              ok = file:close(File),
              Output;
          {error, Reason} ->
              throw({output_file_error, Output, Reason})
      end.
  
  default_output_file() ->
      rebar_utils:otp_release() ++ ".dialyzer_warnings".
  
  update_proj_plt(State, Plt, Output) ->
      {Args, _} = rebar_state:command_parsed_args(State),
      case proplists:get_value(update_plt, Args) of
          false ->
              {0, State};
          _ ->
              do_update_proj_plt(State, Plt, Output)
      end.
  
  do_update_proj_plt(State, Plt, Output) ->
      ?INFO("Updating plt...", []),
      {Files, Warnings} = proj_plt_files(State),
      Warnings2 = format_warnings(Output, Warnings),
      {Warnings3, State2} = case read_plt(State, Plt) of
                                {ok, OldFiles} ->
                                    check_plt(State, Plt, Output, OldFiles,
                                              Files);
                                {error, no_such_file} ->
                                    build_proj_plt(State, Plt, Output, Files)
                            end,
      {Warnings2 + Warnings3, State2}.
  
  