summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2016-08-30 15:31:27 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2016-08-30 15:31:27 +0200
commite4144e9f9d783557860ab599c3b5a0fbf879e88d (patch)
treee0e74f8147f4ba41ac2fa25eb5a2a11defafef10
parent31297b06f61ac24587c9705985b6ecdcb2b45ac5 (diff)
downloadrebar-e4144e9f9d783557860ab599c3b5a0fbf879e88d.tar.gz
port_compiler: fix handling of multiple specs
-rw-r--r--src/rebar_port_compiler.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 7aa04ec..9679c80 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -216,15 +216,15 @@ replace_extension(File, OldExt, NewExt) ->
%%
compile_sources(Config, Specs, SharedEnv) ->
- {Res, Db} =
+ {NewBins, Db} =
lists:foldl(
- fun(#spec{sources=Sources, type=Type, opts=Opts}, NewBins) ->
+ fun(#spec{sources=Sources, type=Type, opts=Opts}, Acc) ->
Env = proplists:get_value(env, Opts, SharedEnv),
- compile_each(Config, Sources, Type, Env, {NewBins, []})
- end, [], Specs),
+ compile_each(Config, Sources, Type, Env, Acc)
+ end, {[], []}, Specs),
%% Rewrite clang compile commands database file only if something
%% was compiled.
- case Res of
+ case NewBins of
[] ->
ok;
_ ->
@@ -234,7 +234,7 @@ compile_sources(Config, Specs, SharedEnv) ->
ok = io:fwrite(ClangDbFile, "]~n", []),
ok = file:close(ClangDbFile)
end,
- Res.
+ NewBins.
compile_each(_Config, [], _Type, _Env, {NewBins, CDB}) ->
{lists:reverse(NewBins), lists:reverse(CDB)};