{port_env,
 [{"darwin", "LDFLAGS", "-framework CoreFoundation -framework CoreServices"},
  {"darwin", "CC", "clang"},
  {"darwin", "CFLAGS", "-Wno-deprecated-declarations"},
  {"freebsd", "LDFLAGS", ""},
  {"freebsd", "CC", "cc"},
  {"freebsd", "CFLAGS", ""}]
}.

{hex, [{doc, edoc}]}.

{port_specs,
 [{"darwin", "priv/mac_listener", ["c_src/mac/*.c"]},
  {"freebsd", "priv/kqueue", ["c_src/bsd/*.c"]}
  ]}.

{plugins, [pc, rebar3_hex]}.

{provider_hooks, [
    {pre, [
        {compile, {pc, compile}},
        {clean,   {pc, clean}}
    ]}
]}.
%{pre_hooks, [
%             {"win32",  compile, "make -f c_src/windows/Makefile"},
%             {"win32",  clean,   "make -f c_src/windows/Makefile clean"}
%            ]
%}.

{project_plugins, [rebar3_format]}.

{format, [
    {files, ["src/*.erl", "test/*.erl"]},
    {formatter, otp_formatter},
    {options, #{ line_length => 108,
                 paper => 250,
                 spaces_around_fields => false,
                 inlining => all,
                 inline_clause_bodies => true,
                 inline_expressions => true,
                 inline_qualified_function_composition => true,
                 inline_simple_funs => true,
                 inline_items => all,
                 inline_fields => true,
                 inline_attributes => true
                 }}]}.

{xref_checks,[
    undefined_function_calls,undefined_functions,locals_not_used,
    deprecated_function_calls,deprecated_functions
]}.

{profiles, [
    {test, [
        {deps, [
            {proper, "1.3.0"}
        ]},
        {plugins, [
            {rebar3_proper, "0.12.1"}
        ]},
        {eunit_opts, [verbose]},
        {erl_opts, [
            {src_dirs, ["src", "test"]}
        ]}
    ]}
]}.

{alias, [
    {coverage, [
        {proper, "-c"},
        {cover, "-v --min_coverage=0"}
    ]},
    %% Run this next with `rebar3 as test check`
    {check, [
        compile,
        xref,
        dialyzer,
        eunit,
        coverage
    ]}
]}.