Browse Source

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 years ago
parent
commit
aa0043f1f8
10 changed files with 13 additions and 15 deletions
  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 View File

@ -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(ABORT(Str, Args), rebar_utils:abort(Str, Args)).
-define(CONSOLE(Str, Args), io:format(Str++"~n", Args)). -define(CONSOLE(Str, Args), io:format(Str++"~n", Args)).

+ 1
- 1
src/rebar_api.erl View File

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

+ 1
- 1
src/rebar_base_compiler.erl View File

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

+ 3
- 3
src/rebar_compiler.erl View File

@ -272,7 +272,7 @@ do_compile(CompilerMod, Source, Outs, Config, Opts) ->
?ERROR("Compiling ~ts failed", [NewSource]), ?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error), maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]), ?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
?ABORT
end. end.
do_compile_and_track(CompilerMod, Source, Outs, Config, Opts) -> 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]), ?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error), maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]), ?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
?ABORT
end. end.
store_artifacts(_G, []) -> store_artifacts(_G, []) ->
@ -341,7 +341,7 @@ compile_handler({Error, Source}, [Config | _Rest]) ->
NewSource = format_error_source(Source, Config), NewSource = format_error_source(Source, Config),
?ERROR("Compiling ~ts failed", [NewSource]), ?ERROR("Compiling ~ts failed", [NewSource]),
maybe_report(Error), maybe_report(Error),
?FAIL.
?ABORT.
clean_(CompilerMod, AppInfo, _Label) -> clean_(CompilerMod, AppInfo, _Label) ->
#{src_dirs := SrcDirs, #{src_dirs := SrcDirs,

+ 1
- 1
src/rebar_compiler_dag.erl View File

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

+ 1
- 1
src/rebar_compiler_mib.erl View File

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

+ 1
- 1
src/rebar_erlc_compiler.erl View File

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

+ 1
- 1
src/rebar_file_utils.erl View File

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

+ 1
- 1
src/rebar_parallel.erl View File

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

+ 2
- 1
src/rebar_prv_install_deps.erl View File

@ -429,7 +429,8 @@ warn_skip_deps(AppInfo, State) ->
false -> ok false -> ok
end; end;
true -> true ->
?ERROR(Msg, Args), ?FAIL
?ERROR(Msg, Args),
?ABORT
end. end.
not_needs_compile(App) -> not_needs_compile(App) ->

Loading…
Cancel
Save