-
Notifications
You must be signed in to change notification settings - Fork 1
/
mix.exs
122 lines (109 loc) · 2.67 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
defmodule AoC.MixProject do
use Mix.Project
@source_url "https://github.com/lud/aoc"
@version "0.13.2"
def project do
[
app: :aoc,
version: @version,
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
cli: cli(),
deps: deps(),
docs: docs(),
versioning: versioning(),
modkit: modkit(),
package: package(),
dialyzer: dialyzer()
]
end
defp package do
[
description: "A small framework to solve Advent of Code problems in Elixir",
licenses: ["MIT"],
maintainers: ["Ludovic Demblans <[email protected]>"],
links: %{
"GitHub" => @source_url,
"Change Log" => "https://github.com/lud/aoc/blob/main/CHANGELOG.md"
}
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# Lib
{:cli_mate, "~> 0.6", runtime: false},
{:req, "~> 0.5"},
{:benchee, "~> 1.2"},
{:modkit, "~> 0.6.0"},
{:jason, "> 1.0.0"},
# DX
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
]
end
defp modkit do
[
mount: [
{AoC, "lib/aoc"},
{Mix.Tasks, "lib/mix/tasks", flavor: :mix_task}
]
]
end
def cli do
[
preferred_envs: ["aoc.test": :test, dialyzer: :test]
]
end
defp docs do
[
extras: [
"LICENSE.md": [title: "License"],
"README.md": [title: "Overview"]
],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
formatters: ["html"]
]
end
defp dialyzer do
[
flags: [:unmatched_returns, :error_handling, :unknown, :extra_return],
list_unused_filters: true,
# plt_add_deps: :app_tree,
plt_add_apps: [:mix],
plt_local_path: "_build/plts"
]
end
defp versioning do
[
annotate: true,
before_commit: [
&update_readme/1,
{:add, "README.md"},
&gen_changelog/1,
{:add, "CHANGELOG.md"}
]
]
end
def update_readme(vsn) do
case System.cmd("mix", ["run", "tools/regen-readme.exs", vsn]) do
{_, 0} -> :ok
{out, _} -> {:error, out}
end
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
end