From 6089de017c1eec515c593032c4139c0a3aaa466d Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Thu, 17 Apr 2014 13:40:28 +0000 Subject: [PATCH] switch to feature detection rather than trying to figure out from compiler version/release whether maps should be supported --- config/maps | 1 + rebar.config.script | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 config/maps diff --git a/config/maps b/config/maps new file mode 100644 index 0000000..8aa3993 --- /dev/null +++ b/config/maps @@ -0,0 +1 @@ +maps:keys(#{0 => false, 1 => true}) == [0,1]. \ No newline at end of file diff --git a/rebar.config.script b/rebar.config.script index 8e9493f..ce4ca9f 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,6 +1,8 @@ -application:start(compiler), -case {erlang:system_info(version), application:get_key(compiler, vsn), os:getenv("JSX_NO_MAPS")} of - {X, {ok, Y}, false} when X >= "6.0" andalso Y >= "5.0" -> - CONFIG ++ [{erl_opts, [{d, release_supports_maps}]}]; - _ -> CONFIG +case os:getenv("JSX_NOMAPS") of + false -> + try file:script("config/maps") of {ok, true} -> + [{d, release_supports_maps}] ++ CONFIG + catch _:_ -> CONFIG + end; + _ -> CONFIG end. \ No newline at end of file