-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmix.exs
More file actions
155 lines (144 loc) · 4.83 KB
/
Copy pathmix.exs
File metadata and controls
155 lines (144 loc) · 4.83 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
defmodule LocalizeSql.MixProject do
use Mix.Project
@version "1.0.1"
@source_url "https://github.com/elixir-localize/localize_sql"
def project do
[
app: :localize_sql,
version: @version,
name: "Localize SQL",
source_url: @source_url,
elixir: "~> 1.17",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: maybe_elixir_make() ++ Mix.compilers(),
make_makefile: "c_src/Makefile",
make_targets: ["all"],
make_clean: ["clean"],
start_permanent: Mix.env() == :prod,
deps: deps(),
description: description(),
package: package(),
docs: docs(),
dialyzer: [
plt_add_apps: [:mix, :ecto_sql],
flags: [
:error_handling,
:unknown,
:underspecs,
:extra_return,
:missing_return
]
],
# The audit mix task is CLI glue over `Localize.Ecto.Audit`
# (which is covered); mix tasks are excluded from coverage
# measurement as in the localize repo. The test repos are
# scaffolding from test/support — coverage measures lib/, and the
# SQLite repo is not even started when the extension is absent.
test_coverage: [
ignore_modules: [~r/^Mix\.Tasks\./, Localize.Ecto.TestRepo, Localize.Ecto.SQLiteTestRepo]
]
]
end
def description do
"SQL database support for Localize: locale-aware ICU collation for Ecto queries on " <>
"PostgreSQL and SQLite, tagged-decimal composite types with database-side sum, avg, " <>
"min and max aggregates and arithmetic operators, unit serialization, and range types."
end
def application do
[
extra_applications: [:logger]
]
end
def package do
[
maintainers: ["Kip Cole"],
licenses: ["Apache-2.0"],
links: %{
"GitHub" => @source_url,
"Readme" => "#{@source_url}/blob/v#{@version}/README.md",
"Changelog" => "#{@source_url}/blob/v#{@version}/CHANGELOG.md"
},
# Listed file by file rather than by directory so that a local
# build of the SQLite extension — object files in c_src, the
# shared library in priv — cannot be published by accident.
files: [
"lib",
"priv/localize_sql",
"c_src/localize_icu.c",
"c_src/sqlite3.h",
"c_src/sqlite3ext.h",
"c_src/Makefile",
"mix.exs",
"README*",
"CHANGELOG*",
"LICENSE*"
]
]
end
def docs do
[
main: "readme",
source_ref: "v#{@version}",
formatters: ["html", "markdown"],
extras: [
"README.md",
"guides/using_localize_sql.md",
"guides/collations_in_postgres.md",
"guides/collations_in_sqlite.md",
"CHANGELOG.md",
"LICENSE.md"
],
groups_for_extras: [
Guides: ~r/guides\/.*/
],
skip_undefined_reference_warnings_on: ["CHANGELOG.md"]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# The SQLite ICU extension is opt-in: it needs a C toolchain and the
# ICU development libraries, which PostgreSQL-only users have no
# reason to install. Enable it with the LOCALIZE_SQL_SQLITE_ICU=true
# environment variable or by setting
# `config :localize_sql, :sqlite_icu, true` in config.exs. The config
# key must be in config.exs, not runtime.exs, because it is read at
# compile time to decide whether to include the :elixir_make compiler.
defp maybe_elixir_make do
if sqlite_icu_enabled?() do
[:elixir_make]
else
[]
end
end
defp sqlite_icu_enabled? do
String.downcase(System.get_env("LOCALIZE_SQL_SQLITE_ICU", "false")) == "true" ||
Application.get_env(:localize_sql, :sqlite_icu, false) == true
end
defp deps do
[
{:ecto, "~> 3.12"},
{:localize, "~> 1.0"},
{:ecto_sql, "~> 3.12", optional: true},
{:elixir_make, "~> 0.8", optional: true, runtime: false},
{:postgrex, "~> 0.20", optional: true},
{:exqlite, "~> 0.35", only: [:dev, :test]},
{:ecto_sqlite3, "~> 0.21", only: [:dev, :test]},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.34", only: [:dev, :release], runtime: false}
] ++ maybe_json_polyfill()
end
# json_polyfill (the EEP 68 :json module for OTP 26) is provided for
# this project's own dev/test/CI only — `only:` dependencies never
# enter the hex package requirements. OTP 26 consumers add
# {:json_polyfill, "~> 0.2 or ~> 1.0"} to their own deps, as the
# localize README documents. The conditional avoids fetching it on
# OTP >= 27, where :json is built in.
defp maybe_json_polyfill do
if Code.ensure_loaded?(:json) do
[]
else
[{:json_polyfill, "~> 0.2 or ~> 1.0", only: [:dev, :test]}]
end
end
end