浏览代码

Rename ?FAIL to ?ABORT

The change was possible since R13B04 when macros with many arities
became supported. We never really cleaned that stuff up before so I'm
picking it up while I'm updating that code
pull/2375/head
Fred Hebert 4 年前
父节点
当前提交
aa0043f1f8
共有 10 个文件被更改,包括 13 次插入15 次删除
  1. +1
    -4
      src/rebar.hrl
  2. +1
    -1
      src/rebar_api.erl
  3. +1
    -1
      src/rebar_base_compiler.erl
  4. +3
    -3
      src/rebar_compiler.erl
  5. +1
    -1
      src/rebar_compiler_dag.erl
  6. +1
    -1
      src/rebar_compiler_mib.erl
  7. +1
    -1
      src/rebar_erlc_compiler.erl
  8. +1
    -1
      src/rebar_file_utils.erl
  9. +1
    -1
      src/rebar_parallel.erl
  10. +2
    -1
      src/rebar_prv_install_deps.erl

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

@ -1,7 +1,4 @@
%% 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)).

+ 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.

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

@ -195,7 +195,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).

+ 3
- 3
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, []) ->
@ -341,7 +341,7 @@ 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_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) ->

+ 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_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

+ 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 ->

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

@ -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) ->

正在加载...
取消
保存