Packages
partisan
5.0.0-rc.16
5.0.3
5.0.2
5.0.1
5.0.0
5.0.0-rc.16
5.0.0-rc.8
5.0.0-rc.2
5.0.0-rc.1
5.0.0-beta.24
5.0.0-beta.21
5.0.0-beta.20
5.0.0-beta.18
5.0.0-beta.17
5.0.0-beta.16
5.0.0-beta.15
5.0.0-beta.14
5.0.0-beta.13
4.1.0
3.0.0
2.1.0
2.0.0
1.4.1
1.4.0
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.0
1.1.0
1.0.2
1.0.1
1.0.0
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
0.0.1
Partisan is a scalable and flexible, TCP-based membership system and distribution layer for the BEAM.
Current section
Files
Jump to
Current section
Files
rebar.config.script
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%%
%% We will add the location of the OTP patched modules based on the
%% OTP version
Vsn = erlang:system_info(otp_release),
%% CONFIG is a special variable injected by rebar3.
Eqwalizer =
case os:getenv("PARTISAN_EQWALIZER", false) of
Var when Var == "1" orelse Var == "true" ->
true;
_ ->
false
end,
%% Dynamically adds the Partisan OTP sources to the src_dirs configuration key,
%% based on the OTP version.
SetSrcDirs = fun
(V, Acc) when V >= "24" ->
Default = ["src"],
SrcDirs =
case lists:keyfind(src_dirs, 1, Acc) of
{src_dirs, Val} ->
Val ++ ["priv/otp/24"];
false ->
Default ++ ["priv/otp/24"]
end,
lists:keystore(src_dirs, 1, Acc, {src_dirs, SrcDirs});
(V, _) ->
exit("OTP version " ++ V ++ " not supported by Partisan.")
end,
%% Adds Eqwalizer support only if Vsn >= "25".
%% We do this as the Eqwalizer executable doesn't allow us to use a separate
%% rebar3 profile.
MaybeEqwalizerSupport = fun
(V, Acc0) when V >= "25" ->
{profiles, Profiles0} = lists:keyfind(profiles, 1, Acc0),
{test, Test0} = lists:keyfind(test, 1, Profiles0),
{deps, Deps0} = lists:keyfind(deps, 1, Test0),
Deps = Deps0 ++ [
{eqwalizer_support,
{
git_subdir,
"https://github.com/whatsapp/eqwalizer.git",
{tag, "v0.25.3"},
"eqwalizer_support"
}
}
],
Test = lists:keystore(deps, 1, Test0, {deps, Deps}),
Profiles = lists:keystore(test, 1, Profiles0, {test, Test}),
Acc1 = lists:keystore(profiles, 1, Acc0, {profiles, Profiles}),
Acc1;
%% {project_plugins, Plugs0} = lists:keyfind(project_plugins, 1, Acc1),
%% Plugs = Plugs0 ++ [
%% {eqwalizer_rebar3,
%% {
%% git_subdir,
%% "https://github.com/whatsapp/eqwalizer.git",
%% {branch, "main"},
%% "eqwalizer_rebar3"
%% }
%% }
%% ],
%% lists:keystore(deps, 1, Acc1, {project_plugins, Plugs});
(_, Acc) ->
Acc
end,
case Eqwalizer of
true ->
%% We do not want to add OTP sources as we are not modifying those
%% sources to fix eqwalizer warnings, so that the diff between the
%% original and ours is just due to partisan requirements.
MaybeEqwalizerSupport(Vsn, SetSrcDirs(Vsn, CONFIG));
false ->
SetSrcDirs(Vsn, CONFIG)
end.