summaryrefslogtreecommitdiff
path: root/src/rebar_base_compiler.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-05-10 18:55:50 -0500
committerTristan Sloughter <t@crashfast.com>2015-05-10 19:24:19 -0500
commitfa95321774f930c1d1e294403ee1cdac2d5be428 (patch)
treefbb4958ef930a3e5f6e65e0f725453012c0e4516 /src/rebar_base_compiler.erl
parent062bee5985463ef3dcd35af3b0a34b946fd710f5 (diff)
remove uses of 'case catch'
Diffstat (limited to 'src/rebar_base_compiler.erl')
-rw-r--r--src/rebar_base_compiler.erl33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index 0101218..7193003 100644
--- a/src/rebar_base_compiler.erl
+++ b/src/rebar_base_compiler.erl
@@ -69,12 +69,12 @@ run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt,
simple_compile_wrapper(S, Target, Compile3Fn, C, CheckLastMod)
end).
-ok_tuple(Config, Source, Ws) ->
- {ok, format_warnings(Config, Source, Ws)}.
+ok_tuple(_Config, Source, Ws) ->
+ {ok, format_warnings(Source, Ws)}.
-error_tuple(Config, Source, Es, Ws, Opts) ->
- {error, format_errors(Config, Source, Es),
- format_warnings(Config, Source, Ws, Opts)}.
+error_tuple(_Config, Source, Es, Ws, Opts) ->
+ {error, format_errors(Source, Es),
+ format_warnings(Source, Ws, Opts)}.
%% ===================================================================
%% Internal functions
@@ -114,26 +114,25 @@ compile_each([Source | Rest], Config, CompileFn) ->
skipped ->
?DEBUG("~sSkipped ~s", [rebar_utils:indent(1), filename:basename(Source)]);
Error ->
- ?ERROR("Compiling ~s failed",
- [maybe_absname(Config, Source)]),
+ ?ERROR("Compiling ~s failed", [Source]),
maybe_report(Error),
?DEBUG("Compilation failed: ~p", [Error]),
?FAIL
end,
compile_each(Rest, Config, CompileFn).
-format_errors(Config, Source, Errors) ->
- format_errors(Config, Source, "", Errors).
+format_errors(Source, Errors) ->
+ format_errors(Source, "", Errors).
-format_warnings(Config, Source, Warnings) ->
- format_warnings(Config, Source, Warnings, []).
+format_warnings(Source, Warnings) ->
+ format_warnings(Source, Warnings, []).
-format_warnings(Config, Source, Warnings, Opts) ->
+format_warnings(Source, Warnings, Opts) ->
Prefix = case lists:member(warnings_as_errors, Opts) of
true -> "";
false -> "Warning: "
end,
- format_errors(Config, Source, Prefix, Warnings).
+ format_errors(Source, Prefix, Warnings).
maybe_report({{error, {error, _Es, _Ws}=ErrorsAndWarnings}, {source, _}}) ->
maybe_report(ErrorsAndWarnings);
@@ -148,10 +147,9 @@ maybe_report(_) ->
report(Messages) ->
lists:foreach(fun(Msg) -> io:format("~s~n", [Msg]) end, Messages).
-format_errors(Config, _MainSource, Extra, Errors) ->
+format_errors(_MainSource, Extra, Errors) ->
[begin
- AbsSource = maybe_absname(Config, Source),
- [format_error(AbsSource, Extra, Desc) || Desc <- Descs]
+ [format_error(Source, Extra, Desc) || Desc <- Descs]
end
|| {Source, Descs} <- Errors].
@@ -164,6 +162,3 @@ format_error(AbsSource, Extra, {Line, Mod, Desc}) ->
format_error(AbsSource, Extra, {Mod, Desc}) ->
ErrorDesc = Mod:format_error(Desc),
?FMT("~s: ~s~s~n", [AbsSource, Extra, ErrorDesc]).
-
-maybe_absname(_Config, Filename) ->
- Filename.