summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2012-06-04 10:36:28 -0600
committerDave Smith <dizzyd@dizzyd.com>2012-06-08 07:06:15 -0600
commitc86c99940d06f2c77e449b37ab261d8163486e94 (patch)
tree7aa96d892a20a5eb81a5ae43c18730079f68b217
parentc122eeec7561e74694184b5ffaa338cf962a374c (diff)
Remove ?FAIL in favor of ?ABORT
-rw-r--r--include/rebar.hrl2
-rw-r--r--src/rebar_abnfc_compiler.erl4
-rw-r--r--src/rebar_asn1_compiler.erl2
-rw-r--r--src/rebar_base_compiler.erl4
-rw-r--r--src/rebar_core.erl4
-rw-r--r--src/rebar_ct.erl8
-rw-r--r--src/rebar_deps.erl2
-rw-r--r--src/rebar_erlc_compiler.erl6
-rw-r--r--src/rebar_erlydtl_compiler.erl4
-rw-r--r--src/rebar_escripter.erl4
-rw-r--r--src/rebar_eunit.erl2
-rw-r--r--src/rebar_file_utils.erl2
-rw-r--r--src/rebar_lfe_compiler.erl4
-rw-r--r--src/rebar_neotoma_compiler.erl4
-rw-r--r--src/rebar_otp_app.erl8
-rw-r--r--src/rebar_protobuffs_compiler.erl4
-rw-r--r--src/rebar_reltool.erl8
-rw-r--r--src/rebar_utils.erl8
-rw-r--r--src/rebar_xref.erl2
19 files changed, 43 insertions, 39 deletions
diff --git a/include/rebar.hrl b/include/rebar.hrl
index 0f4e90f..7568898 100644
--- a/include/rebar.hrl
+++ b/include/rebar.hrl
@@ -1,5 +1,5 @@
--define(FAIL, throw({error, failed})).
+-define(ABORT, rebar_utils:abort()).
-define(ABORT(Str, Args), rebar_utils:abort(Str, Args)).
-define(CONSOLE(Str, Args), io:format(Str, Args)).
diff --git a/src/rebar_abnfc_compiler.erl b/src/rebar_abnfc_compiler.erl
index 0e6749a..cb56854 100644
--- a/src/rebar_abnfc_compiler.erl
+++ b/src/rebar_abnfc_compiler.erl
@@ -90,7 +90,7 @@ compile_abnfc(Source, _Target, Config) ->
" https://github.com/nygge/abnfc~n"
" and install it into your erlang library dir~n"
"===============================================~n~n", []),
- ?FAIL;
+ ?ABORT;
true ->
AbnfcOpts = abnfc_opts(Config),
SourceExt = option(source_ext, AbnfcOpts),
@@ -103,6 +103,6 @@ compile_abnfc(Source, _Target, Config) ->
Error ->
?ERROR("Compiling grammar ~s failed:~n ~p~n",
[Source, Error]),
- ?FAIL
+ ?ABORT
end
end.
diff --git a/src/rebar_asn1_compiler.erl b/src/rebar_asn1_compiler.erl
index 40129c9..c9dca1f 100644
--- a/src/rebar_asn1_compiler.erl
+++ b/src/rebar_asn1_compiler.erl
@@ -65,7 +65,7 @@ compile_asn1(Source, Target, Config) ->
ok
end;
{error, _Reason} ->
- ?FAIL
+ ?ABORT
end.
asn_generated_files(AsnDir, SrcDir, IncDir) ->
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index 10a495d..b4308e5 100644
--- a/src/rebar_base_compiler.erl
+++ b/src/rebar_base_compiler.erl
@@ -149,7 +149,7 @@ compile_queue(Pids, Targets) ->
{fail, Error} ->
?DEBUG("Worker compilation failed: ~p\n", [Error]),
- ?FAIL;
+ ?ABORT;
{compiled, Source} ->
?CONSOLE("Compiled ~s\n", [Source]),
@@ -166,7 +166,7 @@ compile_queue(Pids, Targets) ->
{'DOWN', _Mref, _, _Pid, Info} ->
?DEBUG("Worker failed: ~p\n", [Info]),
- ?FAIL
+ ?ABORT
end.
compile_worker(QueuePid, Config, CompileFn) ->
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index 7828c66..a53e4f9 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -67,7 +67,7 @@ process_commands([], _ParentConfig) ->
case erlang:get(operations) of
0 ->
%% none of the commands had an effect
- ?FAIL;
+ ?ABORT;
_ ->
ok
end;
@@ -362,7 +362,7 @@ execute(Command, Modules, Config, ModuleFile, Env) ->
apply_hooks(post_hooks, Config, Command, Env),
ok;
{error, failed} ->
- ?FAIL;
+ ?ABORT;
{Module, {error, _} = Other} ->
?ABORT("~p failed while processing ~s in module ~s: ~s\n",
[Command, Dir, Module,
diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl
index b3e77b0..4f69a29 100644
--- a/src/rebar_ct.erl
+++ b/src/rebar_ct.erl
@@ -83,7 +83,7 @@ clear_log(RawLog) ->
ok = file:write_file(RawLog, LogHeader);
{error, Reason} ->
?ERROR("Could not create log dir - ~p\n", [Reason]),
- ?FAIL
+ ?ABORT
end.
%% calling ct with erl does not return non-zero on failure - have to check
@@ -98,12 +98,12 @@ check_log(RawLog) ->
MakeFailed ->
show_log(RawLog),
?ERROR("Building tests failed\n",[]),
- ?FAIL;
+ ?ABORT;
RunFailed ->
show_log(RawLog),
?ERROR("One or more tests failed\n",[]),
- ?FAIL;
+ ?ABORT;
true ->
?CONSOLE("DONE.\n~s\n", [Msg])
@@ -257,7 +257,7 @@ find_suite_path(Suite, TestDir) ->
case filelib:is_regular(Path) of
false ->
?ERROR("Suite ~s not found\n", [Suite]),
- ?FAIL;
+ ?ABORT;
true ->
Path
end.
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index f06eb76..dc2fe84 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -123,7 +123,7 @@ setup_env(_Config) ->
?CONSOLE("Dependency not available: "
"~p-~s (~p)\n", [App, Vsn, Src])
end, MissingDeps),
- ?FAIL
+ ?ABORT
end.
'get-deps'(Config, _) ->
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 6535324..dc700e1 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -261,7 +261,7 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
{ok, _} ->
ok;
_ ->
- ?FAIL
+ ?ABORT
end;
false ->
skipped
@@ -282,7 +282,7 @@ compile_mib(Source, Target, Config) ->
rebar_file_utils:mv(Hrl_filename, "include"),
ok;
{error, compilation_failed} ->
- ?FAIL
+ ?ABORT
end.
-spec compile_xrl(Source::file:filename(), Target::file:filename(),
@@ -306,7 +306,7 @@ compile_xrl_yrl(Source, Target, Opts, Mod) ->
{ok, _} ->
ok;
_X ->
- ?FAIL
+ ?ABORT
end;
false ->
skipped
diff --git a/src/rebar_erlydtl_compiler.erl b/src/rebar_erlydtl_compiler.erl
index 9c47a63..2a9cb63 100644
--- a/src/rebar_erlydtl_compiler.erl
+++ b/src/rebar_erlydtl_compiler.erl
@@ -120,7 +120,7 @@ compile_dtl(Source, Target, Config) ->
" http://code.google.com/p/erlydtl/~n"
" and install it into your erlang library dir~n"
"===============================================~n~n", []),
- ?FAIL;
+ ?ABORT;
_ ->
case needs_compile(Source, Target, Config) of
true ->
@@ -146,7 +146,7 @@ do_compile(Source, Target, Config) ->
Reason ->
?ERROR("Compiling template ~s failed:~n ~p~n",
[Source, Reason]),
- ?FAIL
+ ?ABORT
end.
module_name(Target) ->
diff --git a/src/rebar_escripter.erl b/src/rebar_escripter.erl
index f7f45ba..0d091c8 100644
--- a/src/rebar_escripter.erl
+++ b/src/rebar_escripter.erl
@@ -69,12 +69,12 @@ escriptize(Config, AppFile) ->
{error, WriteError} ->
?ERROR("Failed to write ~p script: ~p\n",
[AppName, WriteError]),
- ?FAIL
+ ?ABORT
end;
{error, ZipError} ->
?ERROR("Failed to construct ~p escript: ~p\n",
[AppName, ZipError]),
- ?FAIL
+ ?ABORT
end,
%% Finally, update executable perms for our script
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index b34ad84..d1e847b 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -329,7 +329,7 @@ cover_init(true, BeamFiles) ->
[] ->
%% No modules compiled successfully...fail
?ERROR("Cover failed to compile any modules; aborting.~n", []),
- ?FAIL;
+ ?ABORT;
_ ->
%% At least one module compiled successfully
diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl
index 2a782f0..6eb2ab1 100644
--- a/src/rebar_file_utils.erl
+++ b/src/rebar_file_utils.erl
@@ -106,7 +106,7 @@ delete_each([File | Rest]) ->
delete_each(Rest);
{error, Reason} ->
?ERROR("Failed to delete file ~s: ~p\n", [File, Reason]),
- ?FAIL
+ ?ABORT
end.
%% ===================================================================
diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl
index d2c2dfe..3fe30b9 100644
--- a/src/rebar_lfe_compiler.erl
+++ b/src/rebar_lfe_compiler.erl
@@ -57,7 +57,7 @@ compile_lfe(Source, _Target, Config) ->
" {git, \"git://github.com/rvirding/lfe\",~n"
" {tag, \"v0.6.1\"}}}~n"
"~n", []),
- ?FAIL;
+ ?ABORT;
_ ->
Opts = [{i, "include"}, {outdir, "ebin"}, report]
++ rebar_config:get_list(Config, erl_opts, []),
@@ -65,6 +65,6 @@ compile_lfe(Source, _Target, Config) ->
{ok, _} ->
ok;
_ ->
- ?FAIL
+ ?ABORT
end
end.
diff --git a/src/rebar_neotoma_compiler.erl b/src/rebar_neotoma_compiler.erl
index 9bff892..d0f618f 100644
--- a/src/rebar_neotoma_compiler.erl
+++ b/src/rebar_neotoma_compiler.erl
@@ -80,7 +80,7 @@ compile_neo(Source, Target, Config) ->
" https://github.com/seancribbs/neotoma~n"
" and install it into your erlang library dir~n"
"===============================================~n~n", []),
- ?FAIL;
+ ?ABORT;
_ ->
case needs_compile(Source, Target, Config) of
true ->
@@ -104,7 +104,7 @@ do_compile(Source, _Target, Config) ->
Reason ->
?ERROR("Compiling peg ~s failed:~n ~p~n",
[Source, Reason]),
- ?FAIL
+ ?ABORT
end.
needs_compile(Source, Target, Config) ->
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index 89730a6..0b2e8be 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -146,12 +146,12 @@ validate_name(AppName, File) ->
false ->
?ERROR("Invalid ~s: name of application (~p) "
"must match filename.\n", [File, AppName]),
- ?FAIL
+ ?ABORT
end.
validate_modules(AppName, undefined) ->
?ERROR("Missing modules declaration in ~p.app~n", [AppName]),
- ?FAIL;
+ ?ABORT;
validate_modules(AppName, Mods) ->
%% Construct two sets -- one for the actual .beam files in ebin/
@@ -169,7 +169,7 @@ validate_modules(AppName, Mods) ->
M <- MissingBeams]),
?ERROR("One or more modules listed in ~p.app are not "
"present in ebin/*.beam:\n~s", [AppName, Msg1]),
- ?FAIL
+ ?ABORT
end,
%% Identify .beam files NOT list in the .app, but present in ebin/
@@ -181,7 +181,7 @@ validate_modules(AppName, Mods) ->
M <- MissingMods]),
?ERROR("One or more .beam files exist that are not "
"listed in ~p.app:\n~s", [AppName, Msg2]),
- ?FAIL
+ ?ABORT
end.
ebin_modules() ->
diff --git a/src/rebar_protobuffs_compiler.erl b/src/rebar_protobuffs_compiler.erl
index 249588c..ea34d4f 100644
--- a/src/rebar_protobuffs_compiler.erl
+++ b/src/rebar_protobuffs_compiler.erl
@@ -53,7 +53,7 @@ compile(_Config, _AppFile) ->
false ->
?ERROR("Protobuffs library not present in code path!\n",
[]),
- ?FAIL
+ ?ABORT
end
end.
@@ -115,7 +115,7 @@ compile_each([{Proto, Beam, Hrl} | Rest]) ->
Other ->
?ERROR("Protobuff compile of ~s failed: ~p\n",
[Proto, Other]),
- ?FAIL
+ ?ABORT
end;
false ->
ok
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl
index c114811..cf817e8 100644
--- a/src/rebar_reltool.erl
+++ b/src/rebar_reltool.erl
@@ -58,10 +58,10 @@ generate(Config, ReltoolFile) ->
ok ->
ok;
{error, failed} ->
- ?FAIL;
+ ?ABORT;
Other2 ->
?ERROR("Unexpected error: ~p\n", [Other2]),
- ?FAIL
+ ?ABORT
end.
overlay(_Config, ReltoolFile) ->
@@ -235,12 +235,12 @@ mk_target_dir(TargetDir) ->
_ ->
?ERROR("Release target directory ~p already exists!\n",
[TargetDir]),
- ?FAIL
+ ?ABORT
end;
{error, Reason} ->
?ERROR("Failed to make target dir ~p: ~s\n",
[TargetDir, file:format_error(Reason)]),
- ?FAIL
+ ?ABORT
end.
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index b01a35a..70af4f2 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -37,7 +37,7 @@
ensure_dir/1,
beam_to_mod/2, beams/1,
erl_to_mod/1,
- abort/2,
+ abort/0, abort/2,
escript_foldl/3,
find_executable/1,
prop_check/3,
@@ -137,10 +137,14 @@ ensure_dir(Path) ->
Error
end.
+-spec abort() -> no_return().
+abort() ->
+ delayed_halt(1).
+
-spec abort(string(), [term()]) -> no_return().
abort(String, Args) ->
?ERROR(String, Args),
- delayed_halt(1).
+ abort().
%% TODO: Rename emulate_escript_foldl to escript_foldl and remove
%% this function when the time is right. escript:foldl/3 was an
diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl
index 94103eb..73afdf9 100644
--- a/src/rebar_xref.erl
+++ b/src/rebar_xref.erl
@@ -90,7 +90,7 @@ xref(Config, _) ->
case lists:member(false, [ExportsNoWarn, UndefNoWarn, QueryNoWarn]) of
true ->
- ?FAIL;
+ ?ABORT;
false ->
ok
end.