diff --git a/apps/rebar/src/rebar_base_compiler.erl b/apps/rebar/src/rebar_base_compiler.erl index e3f557990..24f9a2027 100644 --- a/apps/rebar/src/rebar_base_compiler.erl +++ b/apps/rebar/src/rebar_base_compiler.erl @@ -32,6 +32,7 @@ run/7, run/8, ok_tuple/2, + ok_tuple/4, error_tuple/4, error_tuple/5, report/1, @@ -133,6 +134,12 @@ run(Config, FirstFiles, SourceDir, SourceExt0, TargetDir, TargetExt, ok_tuple(Source, Ws) -> {ok, format_warnings(Source, Ws)}. +%% @doc Format good compiler results with warnings to work with +%% module internals. Assumes that warnings are not treated as errors. +-spec ok_tuple(file:filename(), [string()], rebar_dict(), [{_,_}]) -> {ok, [string()]}. +ok_tuple(Source, Ws, Config, Opts) -> + {ok, format_warnings(Source, Ws, Config, Opts)}. + %% @doc format error and warning strings for a given source file %% according to user preferences. -spec error_tuple(file:filename(), [Err], [Warn], rebar_dict() | [{_,_}]) -> diff --git a/apps/rebar/src/rebar_compiler.erl b/apps/rebar/src/rebar_compiler.erl index d4f7e38e2..a2f71c6f3 100644 --- a/apps/rebar/src/rebar_compiler.erl +++ b/apps/rebar/src/rebar_compiler.erl @@ -8,6 +8,7 @@ needs_compile/3, ok_tuple/2, + ok_tuple/4, error_tuple/4, error_tuple/5, maybe_report/1, @@ -128,6 +129,9 @@ needs_compile(Source, OutExt, Mappings) -> ok_tuple(Source, Ws) -> rebar_base_compiler:ok_tuple(Source, Ws). +ok_tuple(Source, Ws, Config, Opts) -> + rebar_base_compiler:ok_tuple(Source, Ws, Config, Opts). + error_tuple(Source, Es, Ws, Opts) -> rebar_base_compiler:error_tuple(Source, Es, Ws, Opts). diff --git a/apps/rebar/src/rebar_compiler_erl.erl b/apps/rebar/src/rebar_compiler_erl.erl index 57bd685d8..26263edc4 100644 --- a/apps/rebar/src/rebar_compiler_erl.erl +++ b/apps/rebar/src/rebar_compiler_erl.erl @@ -138,7 +138,7 @@ compile(Source, [{_, OutDir}], Config, ErlOpts) -> ok; {ok, _Mod, Ws} -> FormattedWs = format_error_sources(Ws, Config), - rebar_compiler:ok_tuple(Source, FormattedWs); + rebar_compiler:ok_tuple(Source, FormattedWs, Config, ErlOpts); {error, Es, Ws} -> error_tuple(Source, Es, Ws, Config, ErlOpts); error -> @@ -161,7 +161,7 @@ compile_and_track(Source, [{Ext, OutDir}], Config, ErlOpts) -> {ok, [{Source, Target, AllOpts}]}; {ok, _Mod, Ws} -> FormattedWs = format_error_sources(Ws, Config), - {ok, Warns} = rebar_compiler:ok_tuple(Source, FormattedWs), + {ok, Warns} = rebar_compiler:ok_tuple(Source, FormattedWs, Config, ErlOpts), {ok, [{Source, Target, AllOpts}], Warns}; {error, Es, Ws} -> error_tuple(Source, Es, Ws, Config, ErlOpts); diff --git a/apps/rebar/src/rebar_compiler_xrl.erl b/apps/rebar/src/rebar_compiler_xrl.erl index 3d3390cb1..15b42ff67 100644 --- a/apps/rebar/src/rebar_compiler_xrl.erl +++ b/apps/rebar/src/rebar_compiler_xrl.erl @@ -39,7 +39,7 @@ compile(Source, [{_, _}], Config, Opts) -> {ok, _} -> ok; {ok, _Mod, Ws} -> - rebar_compiler:ok_tuple(Source, Ws); + rebar_compiler:ok_tuple(Source, Ws, Config, Opts); {error, Es, Ws} -> rebar_compiler:error_tuple(Source, Es, Ws, Config, Opts) end. diff --git a/apps/rebar/src/rebar_compiler_yrl.erl b/apps/rebar/src/rebar_compiler_yrl.erl index 4692d480f..a9740afdc 100644 --- a/apps/rebar/src/rebar_compiler_yrl.erl +++ b/apps/rebar/src/rebar_compiler_yrl.erl @@ -46,7 +46,7 @@ compile(Source, [{_, OutDir}], Config, Opts0) -> {ok, _} -> ok; {ok, _Mod, Ws} -> - rebar_compiler:ok_tuple(Source, Ws); + rebar_compiler:ok_tuple(Source, Ws, Config, AllOpts); {error, Es, Ws} -> rebar_compiler:error_tuple(Source, Es, Ws, Config, AllOpts) end.