% -*- mode: erlang; -*- vim: set ft=erlang:

%% == Erlang Compiler == %%

{erl_opts, [
    debug_info,
    warn_export_vars,
    warn_missing_spec,
    warn_unused_import,
    % warnings_as_errors,
    %
    % EEP-48
    {platform_define, "^2[7-9]\\.", 'E48'},
    {platform_define, "^[3-9]", 'E48'}
]}.

%% == Dependencies and plugins ==

{deps, []}.

{project_plugins, [
    {erlfmt, "~> 1.7"},
    {rebar3_ex_doc, "~> 0.2.30"},
    {rebar3_hank, "~> 1.4"},
    {rebar3_hex, "~> 7.0"},
    {rebar3_lint, "~> 4.1.0"}
]}.

%% == Formatter ==

{erlfmt, [write]}.

%% == Dialyzer ==

{dialyzer, [
    {warnings, [
        error_handling,
        % we use improper lists extensively
        no_improper_lists,
        underspecs,
        unknown,
        unmatched_returns
    ]},
    {plt_extra_apps, [
        common_test,
        doctest,
        eunit
    ]}
]}.

%% == Xref ==

{xref_checks, [
    deprecated_function_calls,
    exports_not_used,
    locals_not_used,
    undefined_function_calls
]}.

%% == Profiles ==

{profiles, [
    {shell, [
        {deps, [
            {recon, "~> 2.5"}
        ]}
    ]},

    {test, [
        {erl_opts, [
            debug_info,
            nowarn_export_all,
            nowarn_missing_spec,
            nowarnings_as_errors
        ]},
        {deps, [
            {doctest, "~> 0.13.1"}
        ]},
        {shell, [
            {apps, [xb5]},
            {config, "test/config/sys.config"}
        ]},
        {ct_opts, [{timing, true}]},
        % {cover_enabled, true},
        {cover_opts, [verbose]}
    ]}
]}.

% doctest: required to pretty print and correctly displays the failed Eunit tests.
{eunit_opts, [no_tty, {report, {doctest_eunit_report, []}}]}.

%% == Docs ==

{edoc_opts, [
    {includes, ["."]}
]}.

{ex_doc, [
    {prefix_ref_vsn_with_v, false},
    {source_url, <<"https://github.com/g-andrade/xb5">>},
    {extras, [<<"README.md">>, <<"CHANGELOG.md">>, <<"LICENSE.txt">>]},
    {main, <<"readme">>},
    {proglang, erlang},
    {groups_for_modules, [
        {<<"API">>, [
            xb5_bag,
            xb5_sets,
            xb5_trees
        ]},
        {<<"Internal nodes">>, [
            xb5_bag_node,
            xb5_bag_utils,
            xb5_sets_node,
            xb5_trees_node
        ]},
        {<<"Debug">>, [
            xb5_structural_stats
        ]}
    ]}
]}.

{hex, [
    {doc, #{
        provider => ex_doc
    }}
]}.
