Current section

Files

Jump to
texture mix.exs
Raw

mix.exs

defmodule Texture.MixProject do
use Mix.Project
@source_url "https://github.com/lud/texture"
@version "1.2.0"
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
{:libdev, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:readmix, ">= 0.0.0", only: [:dev, :test], runtime: false}
]
end
def cli do
[
preferred_envs: [
dialyzer: :test
]
]
end
defp package do
[
licenses: ["Apache-2.0"],
links: %{
"Github" => @source_url,
"Changelog" => "https://github.com/lud/texture/blob/main/CHANGELOG.md"
}
]
end
defp versioning do
[
annotate: true,
before_commit: [
&readmix/1,
{:add, "README.md"},
&gen_changelog/1,
{:add, "CHANGELOG.md"}
]
]
end
def readmix(vsn) do
rdmx = Readmix.new(vars: %{app_vsn: vsn})
:ok = Readmix.update_file(rdmx, "README.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