-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmix.exs
111 lines (99 loc) · 2.78 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
defmodule NervesTimeZones.MixProject do
use Mix.Project
@app :nerves_time_zones
@version "0.3.6"
@source_url "https://github.com/nerves-time/nerves_time_zones"
@tzdata_version "2024b"
@tzdata_earliest_date DateTime.to_unix(~U[2022-01-01 00:00:00Z])
@tzdata_latest_date System.os_time(:second) + 10 * 365 * 86400
def project do
[
app: @app,
version: @version,
elixir: "~> 1.13",
description: description(),
package: package(),
source_url: @source_url,
compilers: [:elixir_make | Mix.compilers()],
make_env: &make_env/0,
make_error_message: "",
make_targets: ["all"],
make_clean: ["clean"],
docs: docs(),
start_permanent: Mix.env() == :prod,
deps: deps(),
dialyzer: [
flags: [:unmatched_returns, :error_handling, :missing_return, :extra_return, :underspecs]
],
preferred_cli_env: %{
docs: :docs,
"hex.publish": :docs,
"hex.build": :docs
}
]
end
def application do
[
extra_applications: [:logger],
mod: {NervesTimeZones.Application, []}
]
end
defp description do
"Time zones for Nerves"
end
defp package do
%{
files: [
"CHANGELOG.md",
"c_src/*.[ch]",
"lib",
"LICENSE",
"mix.exs",
"README.md",
"Makefile",
"tzcode/private.h",
"tzcode/README.md",
"tzcode/tzfile.h",
"tzcode/version",
"tzcode/zic.c",
"tzdata.mk"
],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
}
end
defp deps do
[
{:zoneinfo, "~> 0.1.2"},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.22", only: :docs, runtime: false},
{:dialyxir, "~> 1.4.0", only: :dev, runtime: false},
{:elixir_make, "~> 0.6", runtime: false}
]
end
defp docs do
[
extras: ["README.md", "CHANGELOG.md"],
main: "readme",
source_ref: "v#{@version}",
source_url: @source_url
]
end
defp make_env() do
tzdata_version = Application.get_env(@app, :version, @tzdata_version)
tzdata_earliest_date = Application.get_env(@app, :earliest_date, @tzdata_earliest_date)
tzdata_latest_date = Application.get_env(@app, :latest_date, @tzdata_latest_date)
if tzdata_version != @tzdata_version do
msg = """
TZ database version #{tzdata_version} differs from the offically supported version #{@tzdata_version}
This is useful for unit and compatability tests, but should be avoided in production.
"""
IO.warn(msg, [])
end
%{
"TZDATA_VERSION" => tzdata_version,
"TZDATA_EARLIEST_DATE" => to_string(tzdata_earliest_date),
"TZDATA_LATEST_DATE" => to_string(tzdata_latest_date)
}
end
end