summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-06-01 01:17:49 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-06-11 19:41:51 +0200
commit658f4847a2f78790fdb5ec4aa82488b904c79502 (patch)
tree93ca5cf2ffdeb525622fa7429308b762362924c7 /src
parentdff60918cbc3f7410bd47200bc82ed11bebc2a34 (diff)
Report warnings as errors if -Werror is enabled
Diffstat (limited to 'src')
-rw-r--r--src/rebar_base_compiler.erl11
-rw-r--r--src/rebar_erlc_compiler.erl4
2 files changed, 11 insertions, 4 deletions
diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl
index 3939c97..3750e5b 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_errors/2, format_warnings/2, format_warnings/3]).
%% ===================================================================
@@ -84,7 +84,14 @@ format_errors(Source, Errors) ->
format_errors(Source, "", Errors).
format_warnings(Source, Warnings) ->
- format_errors(Source, "Warning: ", 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).
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index b3b5305..23b8963 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -265,7 +265,7 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) ->
{ok, rebar_base_compiler:format_warnings(Source, Ws)};
{error, Es, Ws} ->
{error, rebar_base_compiler:format_errors(Source, Es),
- rebar_base_compiler:format_warnings(Source, Ws)}
+ rebar_base_compiler:format_warnings(Source, Ws, Opts)}
end;
false ->
skipped
@@ -313,7 +313,7 @@ compile_xrl_yrl(Source, Target, Opts, Mod) ->
{ok, rebar_base_compiler:format_warnings(Source, Ws)};
{error, Es, Ws} ->
{error, rebar_base_compiler:format_errors(Source, Es),
- rebar_base_compiler:format_warnings(Source, Ws)}
+ rebar_base_compiler:format_warnings(Source, Ws, Opts)}
end;
false ->
skipped