-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmix.exs
125 lines (112 loc) · 3.12 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
defmodule Toml.MixProject do
use Mix.Project
@version "0.7.0"
@source_url "https://github.com/bitwalker/toml-elixir"
def project do
[
app: :toml,
version: @version,
elixir: "~> 1.9",
start_permanent: Mix.env() == :prod,
consolidate_protocols: Mix.env() != :test,
description: "An implementation of TOML for Elixir projects",
package: package(),
deps: deps(),
aliases: aliases(Mix.env()),
preferred_cli_env: [
bench: :bench,
"bench.decoder": :bench,
"bench.lexer": :bench,
docs: :docs,
"hex.publish": :docs,
coveralls: :test,
"coveralls.html": :test,
"coveralls.details": :test
],
dialyzer: dialyzer(),
docs: docs(),
elixirc_paths: elixirc_paths(Mix.env()),
escript: escript(Mix.env()),
test_coverage: [tool: ExCoveralls]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: []
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ex_doc, ">= 0.0.0", only: [:docs]},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
{:benchee, "~> 1.0", only: [:bench]},
{:benchee_html, "~> 1.0", only: [:bench]},
{:jason, "~> 1.0", only: [:test, :bench]},
{:excoveralls, "~> 0.9", only: [:test]}
# For benchmarking, though none of these libraries work at this point
# {:tomlex, "~> 0.0.5", only: [:bench]},
# {:toml_elixir, "~> 2.0.1", only: [:bench]},
# {:jerry, "~> 0.1.4", only: [:bench]},
# {:etoml, "~> 0.1.0", only: [:bench]},
]
end
defp package do
[
files: ["lib", "mix.exs", "README.md", "LICENSE"],
maintainers: ["Paul Schoenfelder"],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
]
end
defp docs do
[
main: "readme",
source_url: @source_url,
source_ref: @version,
extras: [
LICENSE: [title: "License"],
"README.md": [title: "Overview"]
],
formatters: ["html"]
]
end
defp escript(:test) do
[
main_module: Toml.CLI,
name: :toml,
path: Path.join([__DIR__, "bin", "toml"])
]
end
defp escript(_), do: nil
defp aliases(_env) do
[
"compile-check": [
"compile --warnings-as-errors",
"format --check-formatted --dry-run",
"dialyzer --format dialyxir"
],
clean: ["clean", &clean/1],
bench: ["bench.decoder", "bench.lexer"],
"bench.decoder": ["run bench/bench.decoder.exs"],
"bench.lexer": ["run bench/bench.lexer.exs"]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(:bench), do: ["lib", "bench/support"]
defp elixirc_paths(_), do: ["lib"]
defp dialyzer do
[
ignore_warnings: "dialyzer.ignore",
flags: [:error_handling, :underspecs],
plt_core_path: System.get_env("PLT_PATH") || System.get_env("MIX_HOME")
]
end
defp clean(_args) do
toml = Path.join([__DIR__, "bin", "toml"])
if File.exists?(toml) do
_ = File.rm(toml)
end
end
end