switch to feature detection rather than trying to figure out from

compiler version/release whether maps should be supported
This commit is contained in:
alisdair sullivan 2014-04-17 13:40:28 +00:00
parent 4d058d1616
commit 6089de017c
2 changed files with 8 additions and 5 deletions

1
config/maps Normal file
View file

@ -0,0 +1 @@
maps:keys(#{0 => false, 1 => true}) == [0,1].

View file

@ -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.