Current section

Files

Jump to
partisan rebar.config.script
Raw

rebar.config.script

%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%%
%% CONFIG is a special variable injected by rebar3.
Vsn = erlang:system_info(otp_release),
%% Check minimum OTP version. Compare as an integer: `erlang:system_info(
%% otp_release)' is a string like "27", and a lexicographic string compare is
%% wrong across digit counts (e.g. "9" >= "27" is `true', "100" >= "27" is
%% `false').
CheckOtpVersion = fun(V, Acc) ->
case catch list_to_integer(V) of
N when is_integer(N), N >= 27 ->
Acc;
_ ->
exit("OTP version " ++ V ++ " not supported by Partisan. Requires OTP 27+.")
end
end,
%% NOTE: the post_hook that generates the partisan OTP modules
%% (`partisan_gen_server', `partisan_gen_statem', …) used to live here. It
%% has been moved to `rebar.config' so it is honoured deterministically
%% when partisan is consumed as a hex/git dependency — some rebar3
%% versions do not evaluate a dep's `rebar.config.script' on first
%% fetch, which left consumer projects without the generated modules.
CheckOtpVersion(Vsn, CONFIG).