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

{erl_opts, [debug_info,
            {platform_define, "R14", no_callback_support},
            {platform_define, "^[0-9]+", namespaced_types},
            {platform_define, "^R", no_proxy_sni_support},
            {platform_define, "^(1|(20))", no_customize_hostname_check},
            {platform_define, "^20\.3", buggy_chacha_ciphers}
           ]}.

{erl_first_files,
 ["src/hackney_ssl_certificate.erl" % required by `hackney_ssl' at compile time
 ]}.

{xref_checks, [undefined_function_calls]}.
%% Ignore xref warnings for optional dependencies (quic)
{xref_ignores, [
  %% quic / quic_h3 (HTTP/3 support)
  {quic_h3, connect, 3},
  {quic_h3, request, 2},
  {quic_h3, send_data, 4},
  {quic_h3, cancel, 3},
  {quic_h3, close, 1},
  {quic_h3, get_quic_conn, 1},
  {quic_h3, early_data_accepted, 1},
  {quic, peername, 1},
  {quic, sockname, 1},
  {quic, peercert, 1},
  %% hackney_h3 functions called by hackney_conn
  {hackney_h3, connect, 4},
  {hackney_h3, close, 2},
  {hackney_h3, process, 1},
  {hackney_h3, send_request, 3},
  {hackney_h3, send_request, 6},
  {hackney_h3, send_request_headers, 5},
  {hackney_h3, send_data, 4},
  {hackney_h3, send_body_chunk, 4},
  {hackney_h3, finish_send_body, 3},
  {hackney_h3, parse_response_headers, 1},
  {hackney_h3, peername, 1},
  {hackney_h3, sockname, 1},
  {hackney_h3, peercert, 1},
  {hackney_h3, early_data_accepted, 1},
  {hackney_h3, get_session_ticket, 1},
  {hackney_h3, wait_session_ticket, 2}
]}.

{cover_enabled, true}.
{eunit_opts, [verbose]}.

{pre_hooks, [{clean, "rm -rf *~ */*~ */*.xfm test/*.beam"}]}.

{deps, [
        %% Pure Erlang QUIC + HTTP/3 stack
        {quic, "~>1.7.0"},
        %% Pure Erlang HTTP/2 stack
        {h2, "~>0.10.4"},
        %% WebTransport client (HTTP/3 and HTTP/2) - powers the wt_* API
        {webtransport, "~>0.4.3"},
        {idna, "~>7.1.0"},
        {mimerl, "~>1.4"},
        {certifi, "~>2.17.0"},
        {parse_trans, "3.4.2"},
        {ssl_verify_fun, "~>1.1.0"}
       ]}.

{profiles, [{test, [
               {deps, [{cowboy, "2.16.0"}, {jsx, "3.1.0"}]},
               %% rebar3 can't parse cowboy 2.13+ Elixir-style ">= X and < Y"
               %% reqs for cowlib/ranch; override with bare names so rebar3
               %% resolves them itself (rebar3#2364).
               {overrides, [{override, cowboy, [{deps, [cowlib, ranch]}]}]}
             ]}
           ]}.

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



{project_plugins, [rebar3_ex_doc]}.

{ex_doc, [
    {extras, [
        {"README.md", #{title => "Overview"}},
        {"GETTING_STARTED.md", #{title => "Getting Started"}},
        {"guides/http_guide.md", #{title => "HTTP Guide"}},
        {"guides/http2_guide.md", #{title => "HTTP/2 Guide"}},
        {"guides/http3_guide.md", #{title => "HTTP/3 Guide"}},
        {"guides/websocket_guide.md", #{title => "WebSocket Guide"}},
        {"guides/webtransport_guide.md", #{title => "WebTransport Guide"}},
        {"guides/middleware.md", #{title => "Middleware Guide"}},
        {"guides/design.md", #{title => "Design Guide"}},
        {"guides/MIGRATION.md", #{title => "Migration Guide"}},
        {"NEWS.md", #{title => "Changelog"}},
        {"CONTRIBUTING.md", #{title => "Contributing"}},
        {"DEVELOPMENT.md", #{title => "Development"}},
        {"LICENSE", #{title => "License"}},
        {"NOTICE", #{title => "Notice"}}
    ]},
    {main, "README.md"},
    {source_url, "https://github.com/benoitc/hackney"},
    %% Historical release notes reference functions that have since been
    %% removed; suppress those auto-link warnings.
    {skip_undefined_reference_warnings_on, ["NEWS.md", "guides/MIGRATION.md"]}
]}.

%% == Dialyzer ==
%%
{dialyzer, [
  {warnings, [
%   race_conditions,
    no_return,
    unmatched_returns,
    error_handling%,
    %unknown
  ]},
  {base_plt_apps, [erts, stdlib, kernel, crypto, runtime_tools]},
  {plt_apps, top_level_deps},
  {plt_extra_apps, [quic, h2, webtransport]},
  {plt_location, local},
  {plt_prefix, "hackney"},
  {base_plt_location, "."},
  {base_plt_prefix, "hackney"}
]}.
