浏览代码

Merge pull request #2375 from ferd/diagnostic-debug-modes

Rework DEBUG=1 mode to be user-centric output and introduce separate DIAGNOSTIC=1 mode for implementer-level logging
pull/2389/head
Fred Hebert 4 年前
提交者 GitHub
父节点
当前提交
5dab019867
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 23 个文件被更改,包括 130 次插入62 次删除
  1. +2
    -4
      src/rebar.hrl
  2. +11
    -7
      src/rebar3.erl
  3. +1
    -1
      src/rebar_api.erl
  4. +6
    -0
      src/rebar_app_discover.erl
  5. +1
    -1
      src/rebar_base_compiler.erl
  6. +8
    -8
      src/rebar_compiler.erl
  7. +1
    -1
      src/rebar_compiler_dag.erl
  8. +1
    -1
      src/rebar_compiler_epp.erl
  9. +2
    -2
      src/rebar_compiler_erl.erl
  10. +1
    -1
      src/rebar_compiler_mib.erl
  11. +8
    -2
      src/rebar_core.erl
  12. +1
    -1
      src/rebar_erlc_compiler.erl
  13. +1
    -1
      src/rebar_fetch.erl
  14. +1
    -1
      src/rebar_file_utils.erl
  15. +4
    -4
      src/rebar_git_resource.erl
  16. +29
    -13
      src/rebar_hooks.erl
  17. +39
    -3
      src/rebar_log.erl
  18. +1
    -1
      src/rebar_parallel.erl
  19. +3
    -3
      src/rebar_pkg_resource.erl
  20. +1
    -0
      src/rebar_prv_compile.erl
  21. +3
    -2
      src/rebar_prv_install_deps.erl
  22. +1
    -1
      src/rebar_state.erl
  23. +4
    -4
      src/rebar_utils.erl

+ 2
- 4
src/rebar.hrl 查看文件

@ -1,11 +1,9 @@
%% TODO: rename FAIL to ABORT once we require at least R13B04 for
%% building rebar. Macros with different arity were not supported by the
%% compiler before 13B04.
-define(FAIL, rebar_utils:abort()).
-define(ABORT, rebar_utils:abort()).
-define(ABORT(Str, Args), rebar_utils:abort(Str, Args)).
-define(CONSOLE(Str, Args), io:format(Str++"~n", Args)).
-define(DIAGNOSTIC(Str, Args), rebar_log:log(diagnostic, Str, Args)).
-define(DEBUG(Str, Args), rebar_log:log(debug, Str, Args)).
-define(INFO(Str, Args), rebar_log:log(info, Str, Args)).
-define(WARN(Str, Args), rebar_log:log(warn, Str, Args)).

+ 11
- 7
src/rebar3.erl 查看文件

@ -283,12 +283,16 @@ set_options(State, {Options, NonOptArgs}) ->
log_level() ->
case os:getenv("QUIET") of
Q when Q == false; Q == "" ->
DefaultLevel = rebar_log:default_level(),
case os:getenv("DEBUG") of
D when D == false; D == "" ->
DefaultLevel;
case os:getenv("DIAGNOSTIC") of
Di when Di == false; Di == "" ->
case os:getenv("DEBUG") of
D when D == false; D == "" ->
rebar_log:default_level();
_ ->
rebar_log:debug_level()
end;
_ ->
DefaultLevel + 3
rebar_log:diagnostic_level()
end;
_ ->
rebar_log:error_level()
@ -335,7 +339,7 @@ handle_error({error, {Module, Reason}}, Stacktrace) ->
case code:which(Module) of
non_existing ->
?CRASHDUMP("~p: ~p~n~p~n~n", [Module, Reason, Stacktrace]),
?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to stacktrace or consult rebar3.crashdump", []),
?ERROR("Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to stacktrace or consult rebar3.crashdump", []),
?DEBUG("Uncaught error: ~p ~p", [Module, Reason]),
?INFO("When submitting a bug report, please include the output of `rebar3 report \"your command\"`", []);
_ ->
@ -349,7 +353,7 @@ handle_error(Error, StackTrace) ->
%% Nothing should percolate up from rebar_core;
%% Dump this error to console
?CRASHDUMP("Error: ~p~n~p~n~n", [Error, StackTrace]),
?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump", []),
?ERROR("Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump", []),
?DEBUG("Uncaught error: ~p", [Error]),
case StackTrace of
[] -> ok;

+ 1
- 1
src/rebar_api.erl 查看文件

@ -24,7 +24,7 @@
%% @doc Interrupts program flow
-spec abort() -> no_return().
abort() -> ?FAIL.
abort() -> ?ABORT.
%% @doc like {@link error/2}, except it also raises an
%% exception to interrupt program flow.

+ 6
- 0
src/rebar_app_discover.erl 查看文件

@ -31,6 +31,12 @@ do(State, LibDirs) ->
%% There may be a top level src which is an app and there may not
%% Find it here if there is, otherwise define the deps parent as root
TopLevelApp = define_root_app(Apps, State),
?DEBUG("Found top-level apps: [~ts]~n\tusing config: ~p",
[case lists:flatten([[",",rebar_app_info:name(App)] || App <- Apps]) of
[] -> "";
Str -> tl(Str)
end,
[{src_dirs, SrcDirs}, {lib_dirs, LibDirs}]]),
%% Handle top level deps
State1 = lists:foldl(fun(Profile, StateAcc) ->

+ 1
- 1
src/rebar_base_compiler.erl 查看文件

@ -203,7 +203,7 @@ compile_each([Source | Rest], Config, CompileFn) ->
?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
?ABORT
end,
compile_each(Rest, Config, CompileFn).

+ 8
- 8
src/rebar_compiler.erl 查看文件

@ -272,7 +272,7 @@ do_compile(CompilerMod, Source, Outs, Config, Opts) ->
?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
?ABORT
end.
do_compile_and_track(CompilerMod, Source, Outs, Config, Opts) ->
@ -292,7 +292,7 @@ do_compile_and_track(CompilerMod, Source, Outs, Config, Opts) ->
?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
?ABORT
end.
store_artifacts(_G, []) ->
@ -321,27 +321,27 @@ compile_worker(Source, [Opts, Config, Outs, CompilerMod]) ->
{Result, Source}.
compile_handler({ok, Source}, _Args) ->
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), Source]),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]),
ok;
compile_handler({{ok, Tracked}, Source}, [_, Tracking]) when Tracking ->
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), Source]),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]),
{ok, Tracked};
compile_handler({{ok, Warnings}, Source}, _Args) ->
report(Warnings),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), Source]),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]),
ok;
compile_handler({{ok, Tracked, Warnings}, Source}, [_, Tracking]) when Tracking ->
report(Warnings),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), Source]),
?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]),
{ok, Tracked};
compile_handler({skipped, Source}, _Args) ->
?DEBUG("~sSkipped ~s", [rebar_utils:indent(1), Source]),
?DEBUG("~sSkipped ~s", [rebar_utils:indent(1), filename:basename(Source)]),
ok;
compile_handler({Error, Source}, [Config | _Rest]) ->
NewSource = format_error_source(Source, Config),
?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error),
?FAIL.
?ABORT.
clean_(CompilerMod, AppInfo, _Label) ->
#{src_dirs := SrcDirs,

+ 1
- 1
src/rebar_compiler_dag.erl 查看文件

@ -134,7 +134,7 @@ finalise_populate_sources(G, InDirs, Waiting) ->
{'DOWN', _MRef, process, Pid, Reason} ->
{_Status, Source} = maps:get(Pid, Waiting),
?ERROR("Failed to get dependencies for ~s~n~p", [Source, Reason]),
?FAIL
?ABORT
end.
%% @doc this function scans all the source files found and looks into

+ 1
- 1
src/rebar_compiler_epp.erl 查看文件

@ -145,7 +145,7 @@ list_directory(Dir, Cache) ->
{Cache, []}, DirFiles),
{NewFs#{Dir => Files}, Files};
{error, Reason} ->
?DEBUG("Failed to list ~s, ~p", [Dir, Reason]),
?DIAGNOSTIC("Failed to list ~s, ~p", [Dir, Reason]),
{Cache, []}
end
end.

+ 2
- 2
src/rebar_compiler_erl.erl 查看文件

@ -48,8 +48,8 @@ needed_files(Graph, FoundFiles, _, AppInfo) ->
EbinDir = rebar_app_info:ebin_dir(AppInfo),
RebarOpts = rebar_app_info:opts(AppInfo),
ErlOpts = rebar_opts:erl_opts(RebarOpts),
?DEBUG("erlopts ~p", [ErlOpts]),
?DEBUG("files to compile ~p", [FoundFiles]),
?DEBUG("compile options: {erl_opts, ~p}.", [ErlOpts]),
?DEBUG("files to analyze ~p", [FoundFiles]),
%% Make sure that the ebin dir is on the path
ok = rebar_file_utils:ensure_dir(EbinDir),

+ 1
- 1
src/rebar_compiler_mib.erl 查看文件

@ -91,7 +91,7 @@ compile(Source, OutDirs, _, Opts) ->
rebar_file_utils:mv(HrlFilename, HrlOut),
ok;
{error, compilation_failed} ->
?FAIL
?ABORT
end.
clean(MibFiles, AppInfo) ->

+ 8
- 2
src/rebar_core.erl 查看文件

@ -92,7 +92,8 @@ process_command(State, Command) ->
Namespace = rebar_state:namespace(State),
TargetProviders = providers:get_target_providers(Command, Providers, Namespace),
CommandProvider = providers:get_provider(Command, Providers, Namespace),
?DEBUG("Expanded command sequence to be run: ~p", [TargetProviders]),
?DEBUG("Expanded command sequence to be run: ~w",
[[friendly_provider(P) || P <- TargetProviders]]),
case CommandProvider of
not_found when Command =/= do ->
case Namespace of
@ -136,7 +137,7 @@ process_command(State, Command) ->
do([], State) ->
{ok, State};
do([ProviderName | Rest], State) ->
?DEBUG("Provider: ~p", [ProviderName]),
?DEBUG("Running provider: ~p", [friendly_provider(ProviderName)]),
%% Special providers like 'as', 'do' or some hooks may be passed
%% as a tuple {Namespace, Name}, otherwise not. Handle them
%% on a per-need basis.
@ -176,3 +177,8 @@ format_error({bad_provider_namespace, {Namespace, Name}}) ->
io_lib:format("Undefined command ~ts in namespace ~ts", [Name, Namespace]);
format_error({bad_provider_namespace, Name}) ->
io_lib:format("Undefined command ~ts", [Name]).
%% @private help display a friendlier sequence of provider names by
%% omitting the default namespace if it's not there
friendly_provider({default, P}) -> P;
friendly_provider(P) -> P.

+ 1
- 1
src/rebar_erlc_compiler.erl 查看文件

@ -620,7 +620,7 @@ compile_mib(AppInfo) ->
rebar_file_utils:mv(HrlFilename, AppInclude),
ok;
{error, compilation_failed} ->
?FAIL
?ABORT
end
end.

+ 1
- 1
src/rebar_fetch.erl 查看文件

@ -59,7 +59,7 @@ download_source_(AppInfo, State) ->
code:del_path(filename:absname(filename:join(AppDir1, "ebin"))),
FetchDir = rebar_app_info:fetch_dir(AppInfo),
ok = rebar_file_utils:rm_rf(filename:absname(FetchDir)),
?DEBUG("Moving checkout ~p to ~p", [TmpDir, filename:absname(FetchDir)]),
?DIAGNOSTIC("Moving checkout ~p to ~p", [TmpDir, filename:absname(FetchDir)]),
rebar_file_utils:mv(TmpDir, filename:absname(FetchDir));
Error ->
Error

+ 1
- 1
src/rebar_file_utils.erl 查看文件

@ -366,7 +366,7 @@ delete_each([File | Rest]) ->
delete_each(Rest);
{error, Reason} ->
?ERROR("Failed to delete file ~ts: ~p\n", [File, Reason]),
?FAIL
?ABORT
end.
%% @doc backwards compat layer to pre-utf8 support

+ 4
- 4
src/rebar_git_resource.erl 查看文件

@ -369,12 +369,12 @@ parse_tags(Dir) ->
git_clone_options() ->
Option = case os:getenv("REBAR_GIT_CLONE_OPTIONS") of
false -> "" ; %% env var not set
Opt -> %% env var set to empty or others
false ->
"" ;
Opt ->
?DEBUG("Git Clone Options: ~p",[Opt]),
Opt
end,
?DEBUG("Git clone Option = ~p",[Option]),
Option.
check_type_support() ->

+ 29
- 13
src/rebar_hooks.erl 查看文件

@ -12,20 +12,34 @@
atom() | {atom(), atom()} | string(),
[providers:t()], rebar_app_info:t(), rebar_state:t()) -> rebar_app_info:t().
run_all_hooks(Dir, Type, Command, Providers, AppInfo, State) ->
?DEBUG("Running hooks for ~p in app ~ts (~ts) with configuration:",
[Command, rebar_app_info:name(AppInfo), Dir]),
State1 = rebar_state:current_app(State, AppInfo),
State2 = run_provider_hooks(Dir, Type, Command, Providers, rebar_app_info:opts(AppInfo), State1),
run_hooks(Dir, Type, Command, rebar_app_info:opts(AppInfo), State1),
rebar_state:current_app(State2).
run_all_hooks(Dir, Type, Command, Providers, State) ->
?DEBUG("Running hooks for ~p with configuration:", [Command]),
run_provider_hooks(Dir, Type, Command, Providers, rebar_state:opts(State), State),
run_hooks(Dir, Type, Command, rebar_state:opts(State), State).
run_project_and_app_hooks(Dir, Type, Command, Providers, State) ->
ProjectApps = rebar_state:project_apps(State),
?DEBUG("Running app-specific hooks", []),
[rebar_hooks:run_all_hooks(Dir, Type, Command, Providers, AppInfo, State) || AppInfo <- ProjectApps],
?DEBUG("Running project-wide hooks", []),
run_all_hooks(Dir, Type, Command, Providers, State).
format_error({bad_provider, Type, Command, {Name, Namespace}}) ->
io_lib:format("Unable to run ~ts hooks for '~p', command '~p' in namespace '~p' not found.", [Type, Command, Namespace, Name]);
format_error({bad_provider, Type, Command, Name}) ->
io_lib:format("Unable to run ~ts hooks for '~p', command '~p' not found.", [Type, Command, Name]).
%%%%%%%%%%%%%%%
%%% PRIVATE %%%
%%%%%%%%%%%%%%%
run_provider_hooks(Dir, Type, Command, Providers, Opts, State) ->
case rebar_opts:get(Opts, provider_hooks, []) of
[] ->
@ -40,11 +54,14 @@ run_provider_hooks_(_Dir, _Type, _Command, _Providers, [], State) ->
run_provider_hooks_(Dir, Type, Command, Providers, TypeHooks, State) ->
case proplists:get_all_values(Command, TypeHooks) of
[] ->
?DEBUG("\t{provider_hooks, []}.", []),
State;
HookProviders ->
rebar_paths:set_paths([plugins], State),
Providers1 = rebar_state:providers(State),
State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers++Providers1),
?DEBUG("\t{provider_hooks, [{~p, ~p}]}.",
[Type, HookProviders]),
case rebar_core:do(HookProviders, State1) of
{error, ProviderName} ->
?DEBUG(format_error({bad_provider, Type, Command, ProviderName}), []),
@ -55,11 +72,6 @@ run_provider_hooks_(Dir, Type, Command, Providers, TypeHooks, State) ->
end
end.
format_error({bad_provider, Type, Command, {Name, Namespace}}) ->
io_lib:format("Unable to run ~ts hooks for '~p', command '~p' in namespace '~p' not found.", [Type, Command, Namespace, Name]);
format_error({bad_provider, Type, Command, Name}) ->
io_lib:format("Unable to run ~ts hooks for '~p', command '~p' not found.", [Type, Command, Name]).
run_hooks(Dir, pre, Command, Opts, State) ->
run_hooks(Dir, pre_hooks, Command, Opts, State);
run_hooks(Dir, post, Command, Opts, State) ->
@ -67,17 +79,21 @@ run_hooks(Dir, post, Command, Opts, State) ->
run_hooks(Dir, Type, Command, Opts, State) ->
case rebar_opts:get(Opts, Type, []) of
[] ->
?DEBUG("run_hooks(~p, ~p, ~p) -> no hooks defined\n", [Dir, Type, Command]),
?DEBUG("\t{~p, []}.", [Type]),
?DIAGNOSTIC("run_hooks(~p, ~p, ~p) -> no hooks defined\n", [Dir, Type, Command]),
ok;
Hooks ->
Env = rebar_env:create_env(State, Opts),
lists:foreach(fun({_, C, _}=Hook) when C =:= Command ->
apply_hook(Dir, Env, Hook);
({C, _}=Hook) when C =:= Command ->
apply_hook(Dir, Env, Hook);
(_) ->
continue
end, Hooks)
CommandHooks = lists:filter(
fun({_, C, _}) when C =:= Command -> true;
({C, _}) when C =:= Command -> true;
(_) -> false
end,
Hooks
),
?DEBUG("\t{~p, ~p}.",
[Type, CommandHooks]),
lists:foreach(fun(Hook) -> apply_hook(Dir, Env, Hook) end, CommandHooks)
end.
apply_hook(Dir, Env, {Arch, Command, Hook}) ->

+ 39
- 3
src/rebar_log.erl 查看文件

@ -32,15 +32,19 @@
get_level/0,
error_level/0,
default_level/0,
debug_level/0,
diagnostic_level/0,
intensity/0,
log/3,
is_verbose/1,
valid_level/1]).
valid_level/1,
truncate/1]).
-define(ERROR_LEVEL, 0).
-define(WARN_LEVEL, 1).
-define(INFO_LEVEL, 2).
-define(DEBUG_LEVEL, 3).
-define(DIAGNOSTIC_LEVEL, 4).
-define(DFLT_INTENSITY, high).
%% ===================================================================
@ -73,7 +77,8 @@ init(Caller, Verbosity) ->
?ERROR_LEVEL -> error;
?WARN_LEVEL -> warn;
?INFO_LEVEL -> info;
?DEBUG_LEVEL -> debug
?DEBUG_LEVEL -> debug;
?DIAGNOSTIC_LEVEL -> debug
end,
Intensity = intensity(),
application:set_env(rebar, log_caller, Caller),
@ -92,6 +97,17 @@ get_level() ->
Level
end.
log(diagnostic, Str, Args) ->
%% The diagnostic level is intended for debug info
%% that is useful for rebar3 developers and implementers who
%% understand the internal structure; the debug level
%% itself should aim to be useful for users themselves.
%% The underlying library only supports debug at its lowest
%% level, so we filter on our end of the lib.
case get_level() of
?DIAGNOSTIC_LEVEL -> log(debug, Str, Args);
_ -> ok
end;
log(Level = error, Str, Args) ->
case application:get_env(rebar, log) of
{ok, LogState} ->
@ -118,13 +134,33 @@ crashdump(File, Str, Args) ->
error_level() -> ?ERROR_LEVEL.
default_level() -> ?INFO_LEVEL.
debug_level() -> ?DEBUG_LEVEL.
diagnostic_level() -> ?DIAGNOSTIC_LEVEL.
is_verbose(State) ->
rebar_state:get(State, is_verbose, false).
valid_level(Level) ->
erlang:max(?ERROR_LEVEL, erlang:min(Level, ?DEBUG_LEVEL)).
erlang:max(?ERROR_LEVEL, erlang:min(Level, ?DIAGNOSTIC_LEVEL)).
%% ===================================================================
%% Internal functions
%% ===================================================================
truncate(IoData) ->
Size = iolist_size(IoData),
if Size > 4096 -> [take_bytes(4096, IoData), "[...]"];
Size =< 4096 -> IoData
end.
take_bytes(0, _) -> [];
take_bytes(N, Bin) when is_binary(Bin), byte_size(Bin) > N ->
<<B:N/binary, _>> = Bin,
binary:copy(B); % avoid holding on to large refs
take_bytes(_, Bin) when is_binary(Bin) ->
Bin;
take_bytes(_, []) -> [];
take_bytes(N, [H|T]) when is_integer(H) ->
[H | take_bytes(N-1, T)];
take_bytes(N, [H|T]) when is_binary(H); is_list(H) ->
Res = take_bytes(N, H),
[Res | take_bytes(N-byte_size(Res), T)].

+ 1
- 1
src/rebar_parallel.erl 查看文件

@ -34,7 +34,7 @@ parallel_dispatch(Targets, Pids, Handler, Args) ->
parallel_dispatch(Targets, NewPids, Handler, Args);
{'DOWN', _Mref, _, _Pid, Info} ->
?ERROR("Task failed: ~p", [Info]),
?FAIL;
?ABORT;
{result, Result} ->
case Handler(Result, Args) of
ok ->

+ 3
- 3
src/rebar_pkg_resource.erl 查看文件

@ -220,10 +220,10 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon
CDN = maybe_default_cdn(State),
case request(RepoConfig#{repo_url => CDN}, Name, Vsn, ETag) of
{ok, cached} ->
?INFO("Version cached at ~ts is up to date, reusing it", [CachePath]),
?DEBUG("Version cached at ~ts is up to date, reusing it", [CachePath]),
serve_from_cache(TmpDir, CachePath, Pkg);
{ok, Body, NewETag} ->
?INFO("Downloaded package, caching at ~ts", [CachePath]),
?DEBUG("Downloaded package, caching at ~ts", [CachePath]),
maybe_store_etag_in_cache(UpdateETag, ETagPath, NewETag),
serve_from_download(TmpDir, CachePath, Pkg, Body);
error when ETag =/= <<>> ->
@ -236,7 +236,7 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon
maybe_default_cdn(State) ->
CDN = rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_CDN),
rebar_utils:to_binary(CDN).
rebar_utils:to_binary(CDN).
-spec serve_from_cache(TmpDir, CachePath, Pkg) -> Res when
TmpDir :: file:name(),

+ 1
- 0
src/rebar_prv_compile.erl 查看文件

@ -378,6 +378,7 @@ copy_app_dirs(AppInfo, OldAppDir, AppDir) ->
true ->
OutEbin = filename:join([AppDir, "ebin"]),
filelib:ensure_dir(filename:join([OutEbin, "dummy.beam"])),
?DEBUG("Copying existing files from ~ts to ~ts", [EbinDir, OutEbin]),
rebar_file_utils:cp_r(filelib:wildcard(filename:join([EbinDir, "*"])), OutEbin);
false ->
ok

+ 3
- 2
src/rebar_prv_install_deps.erl 查看文件

@ -382,7 +382,7 @@ symlink_dep(State, From, To) ->
ok ->
RelativeFrom = make_relative_to_root(State, From),
RelativeTo = make_relative_to_root(State, To),
?INFO("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]),
?DEBUG("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]),
ok;
exists ->
ok
@ -429,7 +429,8 @@ warn_skip_deps(AppInfo, State) ->
false -> ok
end;
true ->
?ERROR(Msg, Args), ?FAIL
?ERROR(Msg, Args),
?ABORT
end.
not_needs_compile(App) ->

+ 1
- 1
src/rebar_state.erl 查看文件

@ -510,7 +510,7 @@ create_logic_providers(ProviderModules, State0) ->
?WITH_STACKTRACE(C,T,S)
?DEBUG("~p: ~p ~p", [C, T, S]),
?CRASHDUMP("~p: ~p~n~p~n~n~p", [C, T, S, State0]),
throw({error, "Failed creating providers. Run with DEBUG=1 for stacktrace or consult rebar3.crashdump."})
throw({error, "Failed creating providers. Run with DIAGNOSTIC=1 for stacktrace or consult rebar3.crashdump."})
end.
to_list(#state_t{} = State) ->

+ 4
- 4
src/rebar_utils.erl 查看文件

@ -150,7 +150,7 @@ wordsize() ->
sh_send(Command0, String, Options0) ->
?INFO("sh_send info:\n\tcwd: ~p\n\tcmd: ~ts < ~ts\n",
[rebar_dir:get_cwd(), Command0, String]),
?DEBUG("\topts: ~p\n", [Options0]),
?DIAGNOSTIC("\topts: ~p\n", [Options0]),
DefaultOptions = [use_stdout, abort_on_error],
Options = [expand_sh_flag(V)
@ -177,8 +177,8 @@ sh_send(Command0, String, Options0) ->
%% Val = string() | false
%%
sh(Command0, Options0) ->
?DEBUG("sh info:\n\tcwd: ~p\n\tcmd: ~ts\n", [rebar_dir:get_cwd(), Command0]),
?DEBUG("\topts: ~p\n", [Options0]),
?DIAGNOSTIC("sh info:\n\tcwd: ~p\n\tcmd: ~ts\n", [rebar_dir:get_cwd(), Command0]),
?DIAGNOSTIC("\topts: ~p\n", [Options0]),
DefaultOptions = [{use_stdout, false}, debug_and_abort_on_error],
Options = [expand_sh_flag(V)
@ -190,7 +190,7 @@ sh(Command0, Options0) ->
Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options0, []))),
PortSettings = proplists:get_all_values(port_settings, Options) ++
[exit_status, {line, 16384}, use_stdio, stderr_to_stdout, hide, eof, binary],
?DEBUG("Port Cmd: ~ts\nPort Opts: ~p\n", [Command, PortSettings]),
?DIAGNOSTIC("Port Cmd: ~ts\nPort Opts: ~p\n", [Command, PortSettings]),
Port = open_port({spawn, Command}, PortSettings),
try

正在加载...
取消
保存