mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Manually format port_compiler errors with absolute path
This commit is contained in:
parent
4b9fcda7ab
commit
4e64e0c675
1 changed files with 17 additions and 3 deletions
|
@ -214,16 +214,30 @@ compile_each([Source | Rest], Type, Env, NewBins) ->
|
||||||
Bin = replace_extension(Source, Ext, ".o"),
|
Bin = replace_extension(Source, Ext, ".o"),
|
||||||
case needs_compile(Source, Bin) of
|
case needs_compile(Source, Bin) of
|
||||||
true ->
|
true ->
|
||||||
?CONSOLE("Compiling ~s\n", [Source]),
|
|
||||||
Template = select_compile_template(Type, compiler(Ext)),
|
Template = select_compile_template(Type, compiler(Ext)),
|
||||||
rebar_utils:sh(expand_command(Template, Env, Source, Bin),
|
Cmd = expand_command(Template, Env, Source, Bin),
|
||||||
[{env, Env}]),
|
ShOpts = [{env, Env}, return_on_error, {use_stdout, false}],
|
||||||
|
exec_compiler(Source, Cmd, ShOpts),
|
||||||
compile_each(Rest, Type, Env, [Bin | NewBins]);
|
compile_each(Rest, Type, Env, [Bin | NewBins]);
|
||||||
false ->
|
false ->
|
||||||
?INFO("Skipping ~s\n", [Source]),
|
?INFO("Skipping ~s\n", [Source]),
|
||||||
compile_each(Rest, Type, Env, NewBins)
|
compile_each(Rest, Type, Env, NewBins)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
exec_compiler(Source, Cmd, ShOpts) ->
|
||||||
|
case rebar_utils:sh(Cmd, ShOpts) of
|
||||||
|
{error, {_RC, RawError}} ->
|
||||||
|
AbsSource = filename:absname(Source),
|
||||||
|
?CONSOLE("Compiling ~s\n", [AbsSource]),
|
||||||
|
Error = re:replace(RawError, Source, AbsSource,
|
||||||
|
[{return, list}, global]),
|
||||||
|
?CONSOLE("~s", [Error]),
|
||||||
|
?ABORT;
|
||||||
|
{ok, Output} ->
|
||||||
|
?CONSOLE("Compiling ~s\n", [Source]),
|
||||||
|
?CONSOLE("~s", [Output])
|
||||||
|
end.
|
||||||
|
|
||||||
needs_compile(Source, Bin) ->
|
needs_compile(Source, Bin) ->
|
||||||
%% TODO: Generate depends using gcc -MM so we can also
|
%% TODO: Generate depends using gcc -MM so we can also
|
||||||
%% check for include changes
|
%% check for include changes
|
||||||
|
|
Loading…
Reference in a new issue