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

rnewson pushed a commit to branch optional-proper
in repository https://gitbox.apache.org/repos/asf/couchdb-hqueue.git

commit 709d73817510c559013c481113357642ed5c9d74
Author: Robert Newson <[email protected]>
AuthorDate: Thu Feb 28 14:06:14 2019 +0000

    Make PropEr an optional (test) dependency
---
 rebar.config           | 13 -------------
 rebar.config.script    | 20 ++++++++++++++++++++
 test/hqueue_proper.erl |  2 ++
 test/hqueue_statem.erl |  2 ++
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/rebar.config b/rebar.config
deleted file mode 100644
index 4c4da01..0000000
--- a/rebar.config
+++ /dev/null
@@ -1,13 +0,0 @@
-{deps, [
-    {proper, ".*", {git, "https://github.com/manopapad/proper.git";, "master"}}
-]}.
-
-{port_specs, [
-    {"priv/hqueue.so", ["c_src/hqueue*.c"]}
-]}.
-{port_env, [
-    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -DHQ_ENIF_ALLOC -O3"}
-    %% {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -Wextra"}
-]}.
-{eunit_opts, [verbose]}.
-{erl_opts, [debug_info]}.
diff --git a/rebar.config.script b/rebar.config.script
new file mode 100644
index 0000000..e85ecb2
--- /dev/null
+++ b/rebar.config.script
@@ -0,0 +1,20 @@
+WithProper = code:lib_dir(proper) /= {error, bad_name}.
+
+ErlOpts =
+    [debug_info] ++
+    case WithProper of
+        true ->
+            [{d, 'WITH_PROPER'}];
+        false ->
+            []
+    end,
+
+[{port_specs, [
+    {"priv/hqueue.so", ["c_src/hqueue*.c"]}
+]}.
+{port_env, [
+    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -DHQ_ENIF_ALLOC -O3"}
+    %% {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -Wextra"}
+]}.
+{eunit_opts, [verbose]}.
+{erl_opts, ErlOpts}].
diff --git a/test/hqueue_proper.erl b/test/hqueue_proper.erl
index 0337b01..314d83f 100644
--- a/test/hqueue_proper.erl
+++ b/test/hqueue_proper.erl
@@ -12,6 +12,7 @@
 
 -module(hqueue_proper).
 
+-ifdef(WITH_PROPER).
 -include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
@@ -31,3 +32,4 @@ prop_simple() ->
 simple_test_() ->
     ?_assertEqual(true, ?QC(prop_simple())).
 
+-endif.
diff --git a/test/hqueue_statem.erl b/test/hqueue_statem.erl
index 027d65d..2bc3dc5 100644
--- a/test/hqueue_statem.erl
+++ b/test/hqueue_statem.erl
@@ -12,6 +12,7 @@
 
 -module(hqueue_statem).
 
+-ifdef(WITH_PROPER).
 -include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
@@ -113,3 +114,4 @@ postcondition(#state{queue=Q}, {call, _, is_empty, [_]}, 
Result) ->
 postcondition(_S, {call, _, max_elems, [_]}, Result) ->
     0 < Result.
 
+-endif.

Reply via email to