-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathmix.exs
More file actions
210 lines (180 loc) · 5.64 KB
/
Copy pathmix.exs
File metadata and controls
210 lines (180 loc) · 5.64 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# credo:disable-for-this-file Credo.Check.Refactor.CyclomaticComplexity
defmodule Mix.Tasks.Compile.Appsignal do
use Mix.Task
@requirements "loadpaths"
def run(_args) do
# Remove all :appsignal environment overrides before evaluating mix_helpers.exs
# so that Application.compile_env/3 resolves to production defaults (real modules).
# This prevents fake test modules from being injected into the extension install task.
# The :config key is excluded as it holds user-facing AppSignal configuration.
saved = Application.get_all_env(:appsignal)
Enum.each(saved, fn
{:config, _} -> :ok
{key, _} -> Application.delete_env(:appsignal, key)
end)
{_, _} = Code.eval_file("mix_helpers.exs")
Mix.Appsignal.Helper.install()
Enum.each(saved, fn {key, val} -> Application.put_env(:appsignal, key, val) end)
{:ok, []}
end
end
defmodule Appsignal.Mixfile do
use Mix.Project
@source_url "https://github.com/appsignal/appsignal-elixir"
@version "2.17.3"
def project do
[
app: :appsignal,
version: @version,
name: "AppSignal",
description: description(),
package: package(),
homepage_url: "https://appsignal.com",
test_paths: test_paths(Mix.env()),
elixir: "~> 1.9",
compilers: compilers(Mix.env()),
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
docs: [
main: "readme",
logo: "logo.png",
source_ref: "v#{@version}",
source_url: @source_url,
extras: ["README.md", "CHANGELOG.md"]
],
dialyzer: [
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
plt_add_apps: [:mix],
ignore_warnings: ".dialyzer_ignore.exs"
]
]
end
defp description do
"Collects error and performance data from your Elixir applications and sends it to AppSignal"
end
defp package do
%{
files: [
"lib",
"c_src/*.[ch]",
"mix.exs",
"mix_helpers.exs",
"*.md",
"LICENSE",
"Makefile",
"agent.exs",
"priv/cacert.pem",
"README.md",
"CHANGELOG.md"
],
maintainers: ["Jeff Kreeftmeijer", "Tom de Bruijn"],
licenses: ["MIT"],
links: %{
"Changelog" => "#{@source_url}/blob/main/CHANGELOG.md",
"GitHub" => @source_url
}
}
end
def application do
[
extra_applications: [
:logger,
:runtime_tools
],
mod: {Appsignal, []}
]
end
defp compilers(_), do: [:appsignal] ++ Mix.compilers()
defp test_paths(_), do: ["test/appsignal", "test/mix"]
defp elixirc_paths(env) do
case test?(env) do
true -> ["lib", "test/support"]
false -> ["lib"]
end
end
defp test?(:test), do: true
defp test?(:test_no_nif), do: true
defp test?(:bench), do: true
defp test?(_), do: false
defp deps do
system_version = System.version()
otp_version = System.otp_release()
decorator_version =
case Version.compare(system_version, "1.5.0") do
:lt -> "~> 1.2.3"
_ -> "~> 1.2.3 or ~> 1.3"
end
finch_version =
case Version.compare(system_version, "1.15.0") do
:lt -> ">= 0.19.0 and < 0.22.0"
_ -> "~> 0.19"
end
telemetry_version =
case otp_version < "21" do
true -> "~> 0.4"
false -> "~> 0.4 or ~> 1.0"
end
# httpoison 3.0 depends on hackney 4.0, which pulls in quic and requires
# OTP 26 or later. Cap httpoison at 2.x on older OTP releases.
httpoison_version =
case otp_version < "26" do
true -> "~> 2.0"
false -> "~> 2.0 or ~> 3.0"
end
mime_dependency =
case Version.compare(system_version, "1.10.0") do
:lt -> [{:mime, "~> 1.0", only: [:test, :test_no_nif]}]
_ -> []
end
plug_version =
case Version.compare(system_version, "1.10.0") do
:lt ->
"~> 1.13.6"
_ ->
case Version.compare(system_version, "1.14.0") do
:lt ->
"~> 1.14 and < 1.19.0"
_ ->
# plug 1.20.0 requires Elixir ~> 1.15, so cap it on 1.14.
case Version.compare(system_version, "1.15.0") do
:lt -> "~> 1.14 and < 1.20.0"
_ -> "~> 1.14"
end
end
end
credo_version =
case Version.compare(system_version, "1.13.0") do
:lt -> "1.7.6"
_ -> "~> 1.7"
end
logger_backends_dependency =
case Version.compare(system_version, "1.15.0") do
:lt -> []
_ -> [{:logger_backends, "~> 1.0"}]
end
# hpax is a transitive dependency (via finch/mint). Version 1.0.4 requires
# Elixir ~> 1.15, so pin to the last compatible version on older Elixirs.
hpax_dependency =
case Version.compare(system_version, "1.15.0") do
:lt -> [{:hpax, ">= 1.0.0 and < 1.0.4", override: true}]
_ -> []
end
[
{:castore, "~> 1.0"},
{:certifi, "~> 2.14"},
{:decimal, "~> 2.0 or ~> 3.1"},
{:benchee, "~> 1.0", only: :bench},
{:finch, finch_version},
{:jason, "~> 1.0"},
{:decorator, decorator_version},
{:plug, plug_version, only: [:test, :test_no_nif]},
{:plug_cowboy, "~> 1.0", only: [:test, :test_no_nif]},
{:bypass, "~> 0.6.0", only: [:test, :test_no_nif]},
{:ex_doc, "~> 0.12", only: :dev, runtime: false},
{:credo, credo_version, only: [:test, :dev], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:telemetry, telemetry_version},
{:httpoison, httpoison_version, optional: true}
] ++ mime_dependency ++ logger_backends_dependency ++ hpax_dependency
end
end