Skip to main content

mix.exs

defmodule AirPlay.MixProject do
  use Mix.Project

  @version "0.5.1"
  @source_url "https://git.sr.ht/~sbr/airplay"

  def project do
    [
      app: :airplay,
      version: @version,
      elixir: "~> 1.15",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      name: "AirPlay",
      description:
        "A pure-Elixir AirPlay (RAOP) audio sender: discover receivers and stream " <>
          "lossless ALAC audio to them — no native dependencies.",
      package: package(),
      docs: docs(),
      source_url: @source_url,
      aliases: aliases()
    ]
  end

  def cli do
    [preferred_envs: [precommit: :test]]
  end

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

  defp deps do
    [
      {:ex_doc, "~> 0.34", only: :dev, runtime: false},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false}
    ]
  end

  # `mix precommit` (also wired into the git pre-commit hook via .githooks)
  # gates a commit on: formatting, clean compile, Credo, a dependency-vuln
  # audit, and the test suite.
  defp aliases do
    [
      precommit: [
        "format --check-formatted",
        "compile --warnings-as-errors",
        "credo",
        "deps.audit",
        "test"
      ]
    ]
  end

  defp package do
    [
      licenses: ["GPL-3.0-or-later"],
      links: %{"sourcehut" => @source_url},
      files: ~w(lib mix.exs README.md LICENSE .formatter.exs)
    ]
  end

  defp docs do
    [
      main: "AirPlay",
      extras: ["README.md"],
      source_ref: "v#{@version}",
      groups_for_modules: [
        "AirPlay 1 (RAOP)": [
          AirPlay,
          AirPlay.Discovery,
          AirPlay.Cast,
          AirPlay.Session,
          AirPlay.Player,
          AirPlay.Rtsp,
          AirPlay.Rtp,
          AirPlay.Alac,
          AirPlay.Ntp,
          AirPlay.Source
        ],
        "AirPlay 2 (experimental)": [
          AirPlay.V2.Pairing,
          AirPlay.V2.Srp,
          AirPlay.V2.Crypto,
          AirPlay.V2.TLV,
          AirPlay.V2.Plist,
          AirPlay.V2.Rtsp2,
          AirPlay.V2.SecureChannel,
          AirPlay.V2.Setup,
          AirPlay.V2.Ptp,
          AirPlay.V2.PtpBmca,
          AirPlay.V2.Player
        ]
      ]
    ]
  end
end