Fix cdb processing when a file is skipped

Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/4b4d66cc
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/4b4d66cc
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/4b4d66cc

Branch: refs/heads/master
Commit: 4b4d66cc640fa933be398b5dcde1e4aa51a98cc0
Parents: b709625
Author: Tuncer Ayaz <[email protected]>
Authored: Sun Aug 28 18:09:44 2016 +0200
Committer: Tuncer Ayaz <[email protected]>
Committed: Sun Aug 28 18:36:18 2016 +0200

----------------------------------------------------------------------
 src/rebar_port_compiler.erl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/4b4d66cc/src/rebar_port_compiler.erl
----------------------------------------------------------------------
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 1119e4e..7aa04ec 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -244,15 +244,16 @@ compile_each(Config, [Source | Rest], Type, Env, 
{NewBins, CDB}) ->
     Template = select_compile_template(Type, compiler(Ext)),
     Cmd = expand_command(Template, Env, Source, Bin),
     CDBEnt = cdb_entry(Source, Cmd, Rest),
+    NewCDB = [CDBEnt | CDB],
     case needs_compile(Source, Bin) of
         true ->
             ShOpts = [{env, Env}, return_on_error, {use_stdout, false}],
             exec_compiler(Config, Source, Cmd, ShOpts),
             compile_each(Config, Rest, Type, Env,
-                         {[Bin | NewBins], [CDBEnt | CDB]});
+                         {[Bin | NewBins], NewCDB});
         false ->
             ?INFO("Skipping ~s\n", [Source]),
-            compile_each(Config, Rest, Type, Env, {NewBins, [CDBEnt, CDB]})
+            compile_each(Config, Rest, Type, Env, {NewBins, NewCDB})
     end.
 
 %% Generate a clang compilation db entry for Src and Cmd
@@ -394,7 +395,8 @@ get_port_spec(Config, OsType, {_Arch, Target, Sources, 
Opts}) ->
     LinkLang =
         case lists:any(
                fun(Src) -> compiler(filename:extension(Src)) == "$CXX" end,
-               SourceFiles) of
+               SourceFiles)
+        of
             true  -> cxx;
             false -> cc
         end,

Reply via email to