defmodule Texture.MixProject do use Mix.Project @source_url "https://github.com/lud/texture" @version "0.3.1" def project do [ app: :texture, description: "A collection of structured text parsers.", version: @version, elixir: "~> 1.15", start_permanent: Mix.env() == :prod, deps: deps(), source_url: @source_url, package: package(), dialyzer: dialyzer(), versioning: versioning() ] end def application do [ extra_applications: [:logger] ] end defp deps do [ {:abnf_parsec, "~> 2.0"}, # Dev {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, # Test {:ex_check, "~> 0.16.0", only: [:dev, :test], runtime: false}, {:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false} ] end def cli do [ preferred_envs: [ dialyzer: :test ] ] end defp package do [ licenses: ["MIT"], links: %{ "Github" => @source_url, "Changelog" => "https://github.com/lud/texture/blob/main/CHANGELOG.md" } ] end defp versioning do [ annotate: true, before_commit: [ &gen_changelog/1, {:add, "CHANGELOG.md"} ] ] end defp gen_changelog(vsn) do case System.cmd("git", ["cliff", "--tag", vsn, "-o", "CHANGELOG.md"], stderr_to_stdout: true) do {_, 0} -> IO.puts("Updated CHANGELOG.md with #{vsn}") {out, _} -> {:error, "Could not update CHANGELOG.md:\n\n #{out}"} end end defp dialyzer do [ flags: [:unmatched_returns, :error_handling, :unknown, :extra_return], list_unused_filters: true, plt_add_deps: :app_tree, plt_add_apps: [:ex_unit, :inets], plt_local_path: "_build/plts" ] end end