forked from elixir-sqlite/exqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
166 lines (149 loc) · 4.11 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
defmodule Exqlite.MixProject do
use Mix.Project
@version "0.16.0"
@sqlite_version "3.43.2"
def project do
[
app: :exqlite,
version: @version,
elixir: "~> 1.13",
compilers: [:elixir_make] ++ Mix.compilers(),
make_targets: ["all"],
make_clean: ["clean"],
make_force_build: Application.get_env(:exqlite, :force_build, false),
make_precompiler: make_precompiler(),
make_precompiler_url:
"https://github.com/elixir-sqlite/exqlite/releases/download/v#{@version}/@{artefact_filename}",
make_precompiler_filename: "sqlite3_nif",
make_precompiler_nif_versions: [
versions: ["2.15", "2.16"],
availability: &target_available_for_nif_version?/2
],
cc_precompiler: cc_precompiler(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
package: package(),
description: description(),
test_paths: test_paths(System.get_env("EXQLITE_INTEGRATION")),
elixirc_paths: elixirc_paths(Mix.env()),
dialyzer: dialyzer(),
# Docs
name: "Exqlite",
source_url: "https://github.com/elixir-sqlite/exqlite",
homepage_url: "https://github.com/elixir-sqlite/exqlite",
docs: docs()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
def sqlite_version, do: @sqlite_version
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:db_connection, "~> 2.1"},
{:ex_sqlean, "~> 0.8.5", only: [:dev, :test]},
{:elixir_make, "~> 0.7", runtime: false},
{:cc_precompiler, "~> 0.1", runtime: false},
{:ex_doc, "~> 0.27", only: :dev, runtime: false},
{:temp, "~> 0.4", only: [:dev, :test]},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.3.0", only: [:dev, :test], runtime: false},
{:table, "~> 0.1.0", optional: true}
]
end
defp aliases do
[
lint: ["format --check-formatted", "credo --all", "dialyzer"]
]
end
defp description do
"An Elixir SQLite3 library"
end
defp make_precompiler do
if System.get_env("EXQLITE_USE_SYSTEM") != nil do
nil
else
{:nif, CCPrecompiler}
end
end
def target_available_for_nif_version?(target, nif_version) do
if String.contains?(target, "windows") do
nif_version == "2.16"
else
true
end
end
defp package do
[
files: ~w(
lib
.formatter.exs
mix.exs
README.md
LICENSE
.clang-format
c_src
Makefile*
checksum.exs
),
name: "exqlite",
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/elixir-sqlite/exqlite",
"Changelog" => "https://github.com/elixir-sqlite/exqlite/blob/main/CHANGELOG.md"
}
]
end
defp docs do
[
main: "readme",
extras: docs_extras(),
source_ref: "v#{@version}",
source_url: "https://github.com/elixir-sqlite/exqlite"
]
end
defp docs_extras do
[
"README.md": [title: "Readme"],
"guides/windows.md": [],
"CHANGELOG.md": []
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp test_paths(nil), do: ["test"]
defp test_paths(_any), do: ["integration_test/exqlite"]
defp dialyzer do
[
plt_add_deps: :apps_direct,
plt_add_apps: ~w(table)a
]
end
defp cc_precompiler do
[
cleanup: "clean",
compilers: %{
{:unix, :linux} => %{
:include_default_ones => true,
"x86_64-linux-musl" => "x86_64-linux-musl-",
"aarch64-linux-musl" => "aarch64-linux-musl-",
"riscv64-linux-musl" => "riscv64-linux-musl-",
"x86_64-linux-gnu" => "x86_64-linux-gnu-",
"aarch64-linux-gnu" => "aarch64-linux-gnu-",
"riscv64-linux-gnu" => "riscv64-linux-gnu-"
},
{:unix, :darwin} => %{
:include_default_ones => true
},
{:win32, :nt} => %{
:include_default_ones => true
}
}
]
end
end