From aa0043f1f84327502009383a611fb2899e566c45 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sun, 27 Sep 2020 01:26:18 +0000 Subject: [PATCH] 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 --- src/rebar.hrl | 5 +---- src/rebar_api.erl | 2 +- src/rebar_base_compiler.erl | 2 +- src/rebar_compiler.erl | 6 +++--- src/rebar_compiler_dag.erl | 2 +- src/rebar_compiler_mib.erl | 2 +- src/rebar_erlc_compiler.erl | 2 +- src/rebar_file_utils.erl | 2 +- src/rebar_parallel.erl | 2 +- src/rebar_prv_install_deps.erl | 3 ++- 10 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/rebar.hrl b/src/rebar.hrl index 65b845d9..12629fc4 100644 --- a/src/rebar.hrl +++ b/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)). diff --git a/src/rebar_api.erl b/src/rebar_api.erl index 00eb0541..cbb4b699 100644 --- a/src/rebar_api.erl +++ b/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. diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl index ad81c86c..56589197 100644 --- a/src/rebar_base_compiler.erl +++ b/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). diff --git a/src/rebar_compiler.erl b/src/rebar_compiler.erl index 6ec8d2d4..e718eb41 100644 --- a/src/rebar_compiler.erl +++ b/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, diff --git a/src/rebar_compiler_dag.erl b/src/rebar_compiler_dag.erl index 74e97984..ef01523a 100644 --- a/src/rebar_compiler_dag.erl +++ b/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 diff --git a/src/rebar_compiler_mib.erl b/src/rebar_compiler_mib.erl index e25cc809..e5db42bb 100644 --- a/src/rebar_compiler_mib.erl +++ b/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) -> diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index b9dc60af..1b996b32 100644 --- a/src/rebar_erlc_compiler.erl +++ b/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. diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index ebbd5e99..f01c9d32 100644 --- a/src/rebar_file_utils.erl +++ b/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 diff --git a/src/rebar_parallel.erl b/src/rebar_parallel.erl index e443619c..8e48c9b7 100644 --- a/src/rebar_parallel.erl +++ b/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 -> diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 4bd58057..52c57156 100644 --- a/src/rebar_prv_install_deps.erl +++ b/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) ->