diff options
Diffstat (limited to 'src/rebar_erlc_compiler.erl')
-rw-r--r-- | src/rebar_erlc_compiler.erl | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 30db023..acb8491 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -257,17 +257,32 @@ internal_erl_compile(Source, Config, Outdir, ErlOpts) -> case needs_compile(Source, Target, Hrls) of true -> Opts = [{outdir, filename:dirname(Target)}] ++ - ErlOpts ++ [{i, "include"}, report], + ErlOpts ++ [{i, "include"}, return], case compile:file(Source, Opts) of - {ok, _} -> + {ok, _Mod} -> ok; - _ -> - ?ABORT + {ok, _Mod, Ws} -> + {ok, format_errors(Source, "Warning: ", Ws)}; + {error, Es, Ws} -> + {error, format_errors(Source, Es), + format_errors(Source, "Warning: ", Ws)} end; false -> skipped end. +format_errors(Source, Errors) -> + format_errors(Source, "", Errors). + +format_errors(Source, Extra, Errors) -> + AbsSource = filename:absname(Source), + [lists:append([format_error(AbsSource, Extra, Desc) || Desc <- Descs]) + || {_, Descs} <- Errors]. + +format_error(AbsSource, Extra, {Line, Mod, Desc}) -> + ErrorDesc = Mod:format_error(Desc), + ?FMT("~s:~b: ~s~s", [AbsSource, Line, Extra, ErrorDesc]). + -spec compile_mib(Source::file:filename(), Target::file:filename(), Config::rebar_config:config()) -> 'ok'. compile_mib(Source, Target, Config) -> |