summaryrefslogtreecommitdiff
path: root/src/rebar_base_compiler.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_base_compiler.erl')
-rw-r--r--src/rebar_base_compiler.erl30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index dacb44d..6167e0e 100644
--- a/src/rebar_base_compiler.erl
+++ b/src/rebar_base_compiler.erl
@@ -29,7 +29,7 @@
-include("rebar.hrl").
-export([run/4, run/7, run/8,
- format_errors/2, format_warnings/2, format_warnings/3]).
+ ok_tuple/2, error_tuple/4]).
%% ===================================================================
@@ -80,18 +80,11 @@ run(Config, FirstFiles, SourceDir, SourceExt, TargetDir, TargetExt,
simple_compile_wrapper(S, Target, Compile3Fn, C, CheckLastMod)
end).
-format_errors(Source, Errors) ->
- format_errors(Source, "", Errors).
-
-format_warnings(Source, Warnings) ->
- format_warnings(Source, Warnings, []).
+ok_tuple(Source, Ws) ->
+ {ok, format_warnings(Source, Ws)}.
-format_warnings(Source, Warnings, Opts) ->
- Prefix = case lists:member(warnings_as_errors, Opts) of
- true -> "";
- false -> "Warning: "
- end,
- format_errors(Source, Prefix, Warnings).
+error_tuple(Source, Es, Ws, Opts) ->
+ {error, format_errors(Source, Es), format_warnings(Source, Ws, Opts)}.
%% ===================================================================
%% Internal functions
@@ -218,6 +211,19 @@ compile_worker(QueuePid, Config, CompileFn) ->
ok
end.
+format_errors(Source, Errors) ->
+ format_errors(Source, "", Errors).
+
+format_warnings(Source, Warnings) ->
+ format_warnings(Source, Warnings, []).
+
+format_warnings(Source, Warnings, Opts) ->
+ Prefix = case lists:member(warnings_as_errors, Opts) of
+ true -> "";
+ false -> "Warning: "
+ end,
+ format_errors(Source, Prefix, Warnings).
+
maybe_report([{error, {error, _Es, _Ws}=ErrorsAndWarnings}, {source, _}]) ->
maybe_report(ErrorsAndWarnings);
maybe_report({error, Es, Ws}) ->