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
%%
%% We will add the location of the OTP patched modules based on the
%% OTP version
OTPVersion = erlang:system_info(otp_release),
%% The existing configuration from rebar3. CONFIG is a special variable
%% injected by rebar3
SrcDirs0 =
case lists:keyfind(src_dirs, 1, CONFIG) of
{src_dirs, Val} ->
Val;
false ->
["src"]
end,
FindDir = fun
FindDir(V) when V >= "24" ->
OTPDir = filename:join(["priv", "otp", OTPVersion]),
case filelib:is_dir(OTPDir) of
true ->
SrcDirs = SrcDirs0 ++ [OTPDir],
lists:keystore(src_dirs, 1, CONFIG, {src_dirs, SrcDirs});
false ->
%% We try with a version below
FindDir(integer_to_list(list_to_integer(OTPVersion) - 1))
end;
FindDir(V) ->
exit("OTP version " ++ V ++ " not supported by partisan")
end,
FindDir(OTPVersion).