Current section

Files

Jump to
Raw

mix.exs

defmodule HttpCookie.MixProject do
  use Mix.Project

  @version "0.12.0"
  @source_url "https://github.com/reisub/http_cookie"

  def project do
    [
      app: :http_cookie,
      version: @version,
      elixir: "~> 1.15",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      description: description(),
      package: package(),
      docs: docs(),
      deps: deps(),
      aliases: aliases(),
      dialyzer: dialyzer()
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  defp description do
    "Standards-compliant HTTP Cookie implementation, with support for Req and Tesla."
  end

  defp package do
    [
      licenses: ["Apache-2.0"],
      links: %{
        "GitHub" => @source_url,
        "Changelog" => "https://hexdocs.pm/http_cookie/changelog.html"
      },
      exclude_patterns: ~w[priv/plts lib/http_cookie/date_parser.ex.exs]
    ]
  end

  defp deps do
    [
      {:idna, "~> 7.1"},
      {:public_sufx, "~> 0.8"},
      # ex_doc needs it in the docs environment too
      {:nimble_parsec, "~> 1.0", only: [:dev, :test, :docs]},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:ex_slop, "~> 0.4", only: [:dev, :test], runtime: false},
      {:doctor, "~> 0.23.0", only: [:dev, :test]},
      # The publish workflow uses the docs environment to compile only what it needs
      {:ex_doc, ">= 0.0.0", only: [:dev, :test, :docs], runtime: false},
      {:jump_credo_checks, "~> 0.2", only: [:dev], runtime: false},
      {:quokka, "~> 2.12", only: [:dev, :test], runtime: false},
      {:req, "~> 0.7.1", optional: true},
      {:tesla, "~> 1.11", optional: true},
      {:plug, "~> 1.0", only: :test},
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:benchee, "~> 1.0", only: [:dev, :test]}
    ]
  end

  defp aliases do
    [
      compile_parser: "nimble_parsec.compile lib/http_cookie/date_parser.ex.exs"
    ]
  end

  def dialyzer do
    [
      # Put the project-level PLT in the priv/ directory (instead of the default _build/ location)
      plt_file: {:no_warn, "priv/plts/project.plt"},

      # Also put the core Erlang/Elixir PLT into the priv/ directory like so:
      plt_core_path: "priv/plts/core.plt"
    ]
  end

  defp docs do
    [
      main: "readme",
      source_url: @source_url,
      source_ref: "v#{@version}",
      extras: [
        "README.md",
        "CHANGELOG.md"
      ]
    ]
  end
end