You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2020/04/16 12:16:24 UTC

[couchdb] branch prototype/fdb-layer updated: Merge keys from rebar.config

This is an automated email from the ASF dual-hosted git repository.

iilyak pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
     new 4e2f18c  Merge keys from rebar.config
     new a527ad1  Merge pull request #2783 from cloudant/merge-rebar-config
4e2f18c is described below

commit 4e2f18c03e478855e927d9d0ae7bd757427c2edd
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Tue Apr 14 03:06:25 2020 -0700

    Merge keys from rebar.config
    
    This change allows creation of local `src/couch/rebar.config` and `rebar.config`
    files to set additional configuration options. This is useful for:
    - disabling deprecation warnings `{nowarn_deprecated_function, MFAs}`
    - control debugging in eunit tests
        - `DEBUG` - `{eunit_compile_opts, [{d, DEBUG, true}]}`
        - `NODEBUG` - `{eunit_compile_opts, [{d, NODEBUG, true}]}`
---
 .gitignore                    | 1 +
 rebar.config.script           | 9 +++++++--
 src/couch/.gitignore          | 2 ++
 src/couch/rebar.config.script | 7 ++++++-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 955403a..cd46088 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,7 @@ ebin/
 erl_crash.dump
 erln8.config
 install.mk
+rebar.config
 rel/*.config
 rel/couchdb
 rel/dev*
diff --git a/rebar.config.script b/rebar.config.script
index 6f9f65c..b3ea2c9 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -223,6 +223,11 @@ AddConfig = [
     {post_hooks, [{compile, "escript support/build_js.escript"}]}
 ],
 
-C = lists:foldl(fun({K, V}, CfgAcc) ->
-    lists:keystore(K, 1, CfgAcc, {K, V})
+lists:foldl(fun({K, V}, CfgAcc) ->
+    case lists:keyfind(K, 1, CfgAcc) of
+        {K, Existent} when is_list(Existent) andalso is_list(V) ->
+            lists:keystore(K, 1, CfgAcc, {K, Existent ++ V});
+        false ->
+            lists:keystore(K, 1, CfgAcc, {K, V})
+    end
 end, CONFIG, AddConfig).
diff --git a/src/couch/.gitignore b/src/couch/.gitignore
index e1fa653..861974a 100644
--- a/src/couch/.gitignore
+++ b/src/couch/.gitignore
@@ -19,3 +19,5 @@ test/engines/log/
 
 .rebar/
 .eunit
+
+rebar.config
diff --git a/src/couch/rebar.config.script b/src/couch/rebar.config.script
index 91e24d9..80e6bd1 100644
--- a/src/couch/rebar.config.script
+++ b/src/couch/rebar.config.script
@@ -229,5 +229,10 @@ AddConfig = [
 ].
 
 lists:foldl(fun({K, V}, CfgAcc) ->
-    lists:keystore(K, 1, CfgAcc, {K, V})
+    case lists:keyfind(K, 1, CfgAcc) of
+        {K, Existent} when is_list(Existent) andalso is_list(V) ->
+            lists:keystore(K, 1, CfgAcc, {K, Existent ++ V});
+        false ->
+            lists:keystore(K, 1, CfgAcc, {K, V})
+    end
 end, CONFIG, AddConfig).