-
Notifications
You must be signed in to change notification settings - Fork 4
/
mix.exs
191 lines (173 loc) · 4.08 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
183
184
185
186
187
188
189
190
191
defmodule EdgeDB.MixProject do
use Mix.Project
@app :edgedb
@version "0.7.0"
@source_url "https://github.com/edgedb/edgedb-elixir"
@description "EdgeDB client for Elixir"
def project do
[
app: @app,
version: @version,
elixir: "~> 1.12",
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_options: elixirc_options(),
start_permanent: Mix.env() == :prod,
consolidate_protocols: consolidate_protocols?(Mix.env()),
test_coverage: test_coverage(),
preferred_cli_env: preferred_cli_env(),
dialyzer: dialyzer(),
name: "EdgeDB",
description: @description,
package: package(),
docs: docs(),
aliases: aliases()
]
end
def application do
[
mod: {EdgeDB.Application, []},
extra_applications: [
:crypto,
:logger,
:ssl
]
]
end
defp deps do
[
# core
{:db_connection, "~> 2.0"},
{:elixir_uuid, "~> 1.2"},
{:decimal, "~> 2.0"},
{:jose, "~> 1.11"},
{:crc, "~> 0.10.4"},
{:castore, "~> 0.1.0 or ~> 1.0"},
{:ucwidth, "~> 0.2.0"},
{:jason, "~> 1.2", optional: true},
{:timex, "~> 3.7", optional: true},
# test
{:excoveralls, "~> 0.14", only: [:test, :ci]},
{:mox, "~> 1.0", only: [:test, :ci]},
# ci
{:dialyxir, "~> 1.0", only: [:dev, :ci], runtime: false},
{:credo, "~> 1.2", only: [:dev, :ci], runtime: false},
# docs
{:ex_doc, "~> 0.28", only: [:dev, :ci], runtime: false},
{:panpipe, "~> 0.2", [only: [:ci]]}
]
end
defp elixirc_paths(:test) do
["lib", "test/support"]
end
defp elixirc_paths(_env) do
["lib"]
end
defp elixirc_options do
[
warnings_as_errors: true
]
end
defp consolidate_protocols?(:test) do
false
end
defp consolidate_protocols?(_env) do
true
end
defp test_coverage do
[
tool: ExCoveralls
]
end
defp preferred_cli_env do
[
dialyzer: :ci,
credo: :ci,
docs: :ci,
"edgedb.docs": :ci,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.html": :test
]
end
defp dialyzer do
[
plt_add_apps: [
:ex_unit,
:jason,
:timex
],
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
]
end
defp package do
[
maintainers: [
"Nik Sidnev"
],
licenses: ["Apache-2.0"],
links: %{
"GitHub" => @source_url
}
]
end
defp docs do
[
source_url: @source_url,
source_ref: "v#{@version}",
main: "main",
extras: [
"pages/md/main.md",
"pages/md/usage.md",
"pages/md/datatypes.md",
"pages/md/custom-codecs.md",
"CHANGELOG.md"
],
skip_undefined_reference_warnings_on: ["CHANGELOG.md"],
groups_for_modules: [
"EdgeDB types": [
EdgeDB.Object,
EdgeDB.Set,
EdgeDB.NamedTuple,
EdgeDB.RelativeDuration,
EdgeDB.DateDuration,
EdgeDB.ConfigMemory,
EdgeDB.Range,
EdgeDB.MultiRange
],
Protocol: [
EdgeDB.Protocol.Codec,
EdgeDB.Protocol.CustomCodec,
EdgeDB.Protocol.CodecStorage,
EdgeDB.Protocol.Enums
],
Errors: edgedb_errors(Mix.env())
]
]
end
defp aliases do
[
"edgedb.roles.setup": [
"cmd priv/scripts/setup-roles.sh"
],
"edgedb.roles.reset": [
"cmd priv/scripts/drop-roles.sh",
"cmd priv/scripts/setup-roles.sh"
],
"edgedb.docs": [
"run priv/scripts/edgedb_docs.exs"
]
]
end
# this may take some time, so make sure we only do it when necessary
defp edgedb_errors(:ci) do
error_regex = ~r/^0x(_[0-9A-Fa-f]{2}){4}\s*(?<error_name>\w+)/
for line <- File.stream!("./priv/edgedb/api/errors.txt"), Regex.match?(error_regex, line) do
%{"error_name" => error_name} = Regex.named_captures(error_regex, line)
Module.concat([EdgeDB, error_name])
end
end
defp edgedb_errors(_env) do
[]
end
end