%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% Upgrade by calling 'rebar3 experimental vendor' and making sure
%% any manual patches (Eg. erlware_commons or relx) are kept.
{deps, [{erlware_commons,  "1.8.0"},
        {ssl_verify_fun,   "1.1.6"},
        {certifi,          "2.13.0"},
        {providers,        "1.9.0"},
        {getopt,           "1.0.2"},
        {bbmustache,       "1.12.2"},
        {relx,             "4.10.0"},
        {cf,               "0.3.1"},
        {cth_readable,     "1.6.1"},
        {eunit_formatters, "0.6.0"}]}.

{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)",
               escriptize,
               "cp \"$REBAR_BUILD_DIR/bin/rebar3\" ./rebar3"},
              {"(win32|windows)",
               escriptize,
               "robocopy \"%REBAR_BUILD_DIR%/bin/\" ./ rebar3* "
               "/njs /njh /nfl /ndl & exit /b 0"} % silence things
             ]}.

{escript_name, rebar3}.
{escript_wrappers_windows, ["cmd", "powershell"]}.
{escript_comment, "%%Rebar3 3.27.0\n"}.
{escript_emu_args, "%%! +sbtu +A1\n"}.
%% escript_incl_priv is for internal rebar-private use only.
%% Do not use outside rebar. Config interface is not stable.
{escript_incl_priv, [{relx, "templates/*"},
                     {rebar, "templates/*"}]}.

{overrides, [{add, relx, [{erl_opts, [{d, 'RLX_LOG', rebar_log}]}]}]}.

{erl_opts, [warnings_as_errors]}.

{edoc_opts, [preprocess]}.

%% Use the newest OTP when dialyzing rebar3
{dialyzer, [
    {warnings, [unknown]},
    {plt_extra_apps, [parsetools, public_key]}
]}.

%% Keep only the logs of the last 5 runs
{ct_opts, [{keep_logs, 5}]}.

%% Profiles
{profiles, [{test, [
                   {deps, [{meck, "0.8.13"}]},
                   {erl_opts, [debug_info, nowarn_export_all]}
                   ]
            },

            {dialyzer, [
                {erl_opts, [debug_info, nowarn_export_all]}
            ]},

            {bootstrap, []},

            {prod, [
                {erl_opts, [no_debug_info]},
                {overrides, [
                    {override, erlware_commons, [
                        {erl_opts, [no_debug_info,
                                    warnings_as_errors]},
                        {deps, []}, {plugins, []}]},
                    {add, ssl_verify_hostname, [{erl_opts, [no_debug_info]}]},
                    {add, certifi, [{erl_opts, [no_debug_info]}]},
                    {add, cf, [{erl_opts, [no_debug_info]}]},
                    {add, cth_readable, [{erl_opts, [no_debug_info]}]},
                    {add, eunit_formatters, [{erl_opts, [no_debug_info]}]},
                    {override, bbmustache, [
                        {erl_opts, [no_debug_info, {platform_define, "^[0-9]+", namespaced_types}]},
                        {deps, []}, {plugins, []}]},
                    {add, getopt, [{erl_opts, [no_debug_info]}]},
                    {add, providers, [{erl_opts, [no_debug_info]}]},
                    {add, relx, [{erl_opts, [no_debug_info]}]}]}
            ]}
           ]}.

{compiler_error_format, rich}.
