-
Notifications
You must be signed in to change notification settings - Fork 28
/
mix.exs
182 lines (164 loc) · 4.58 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
defmodule Mixpanel.Mixfile do
use Mix.Project
@external_resource "VERSION"
@version File.read!(Path.join([__DIR__, "VERSION"]))
def project do
[
app: :mixpanel_api_ex,
version: @version,
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
compilers: compilers(Mix.env()),
unused: unused(),
deps: deps(),
aliases: aliases(),
preferred_cli_env: preferred_cli_env(),
dialyzer: [
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
plt_add_deps: :apps_direct,
plt_add_apps: [:logger, :inets],
plt_ignore_apps: [:mix_unused, :propcheck],
flags: [
"-Werror_handling",
"-Wextra_return",
"-Wmissing_return",
"-Wunknown",
"-Wunmatched_returns",
"-Wunderspecs"
]
],
propcheck: [counter_examples: "propcheck_counter_examples"],
test_paths: test_paths(Mix.env()),
test_coverage: [
tool: ExCoveralls,
export: "cov",
test_task: "test",
summary: [
threshold: 80
]
],
# Hex
description: description(),
package: package(),
# Docs
name: "Mixpanel API",
docs: [
extras: ["README.md", "CHANGELOG.md"],
source_ref: "v#{@version}",
main: "Mixpanel",
source_url: "https://github.com/asakura/mixpanel_api_ex"
]
]
end
def description do
"Elixir client for the Mixpanel API."
end
defp elixirc_paths(:test), do: ["test/support", "lib"]
defp elixirc_paths(:property), do: ["property/support", "lib"]
defp elixirc_paths(_), do: ["lib"]
defp test_paths(:property), do: ["property"]
defp test_paths(_), do: ["test"]
def package do
[
maintainers: ["Mikalai Seva"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/asakura/mixpanel_api_ex"},
files: ~w(mix.exs README.md CHANGELOG.md lib VERSION)
]
end
def application() do
[
mod: {Mixpanel, []},
extra_applications: [:logger],
start_phases: [
clients: []
]
]
end
defp compilers(:dev) do
[:unused] ++ Mix.compilers()
end
defp compilers(_), do: Mix.compilers()
defp deps do
[
{:bandit, "~> 1.0", only: :test},
# only to make excoveralls to work on OTP 24
{:castore, "~> 1.0", only: :test},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:excoveralls, "~> 0.18", only: [:test, :property]},
# Erlang 22 comparability layer
# Remove it when OTP 22 support is dropped
unquote_splicing(
if :erlang.system_info(:otp_release) |> to_string() == "22" do
[]
else
quote do
[
{:gradient, github: "esl/gradient", ref: "33e13fb", only: [:dev], runtime: false}
# {:gradient_macros, github: "esl/gradient_macros", ref: "3bce214", runtime: false},
]
end
end
),
{:hackney, "~> 1.20", only: [:test, :dev]},
{:jason, "~> 1.4"},
{:machete, "~> 0.2", only: :test},
{:mix_unused, "~> 0.4.1", only: :dev},
{:mox, "~> 1.1", only: :test},
{:propcheck, "~> 1.4", only: [:property, :dev]},
{:telemetry, "~> 0.4 or ~> 1.0"}
]
end
defp preferred_cli_env do
[
c: :dev,
t: :test,
ti: :test,
p: :property,
"test.property": :property,
coveralls: :test,
"coveralls.github": :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.cobertura": :test
]
end
defp aliases() do
[
c: "compile",
t: "test --no-start",
p: &run_property_tests/1,
d: "dialyzer",
g: "gradient",
test: "test --no-start",
"test.property": &run_property_tests/1
]
end
defp unused() do
[
ignore: [
{:_, :child_spec, :_},
{:_, :start_link, :_}
]
]
end
defp run_property_tests(args) do
env = Mix.env()
args = if IO.ANSI.enabled?(), do: ["--color" | args], else: ["--no-color" | args]
IO.puts("Running tests with `MIX_ENV=#{env}`")
{_, res} =
System.cmd("mix", ["test" | args],
into: IO.binstream(:stdio, :line),
env: [{"MIX_ENV", to_string(env)}]
)
if res > 0 do
System.at_exit(fn _ -> exit({:shutdown, 1}) end)
end
end
end