forked from ejpcmac/typed_struct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
109 lines (94 loc) · 2.5 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
defmodule TypedStruct.MixProject do
use Mix.Project
@version "0.1.4"
@repo_url "https://github.com/ejpcmac/typed_struct"
def project do
[
app: :typed_struct,
version: @version,
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps(),
# Tools
dialyzer: dialyzer(),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: cli_env(),
# Docs
name: "TypedStruct",
docs: [
main: "TypedStruct",
source_url: @repo_url,
source_ref: "v#{@version}"
],
# Package
package: package(),
description:
"A library for defining structs with a type without writing " <>
"boilerplate code."
]
end
defp deps do
[
# Development and test dependencies
{:credo, "~> 0.10.0", only: :dev, runtime: false},
{:dialyxir, "~> 1.0-rc", only: :dev, runtime: false},
{:excoveralls, ">= 0.0.0", only: :test, runtime: false},
{:mix_test_watch, ">= 0.0.0", only: :test, runtime: false},
{:ex_unit_notifier, ">= 0.0.0", only: :test, runtime: false},
# Project dependencies
# Documentation dependencies
{:ex_doc, "~> 0.19", only: :docs, runtime: false}
]
end
# Dialyzer configuration
defp dialyzer do
[
# Use a custom PLT directory for continuous integration caching.
plt_core_path: System.get_env("PLT_DIR"),
plt_file: plt_file(),
plt_add_deps: :transitive,
flags: [
:unmatched_returns,
:error_handling,
:race_conditions
],
ignore_warnings: ".dialyzer_ignore"
]
end
defp plt_file do
case System.get_env("PLT_DIR") do
nil -> nil
plt_dir -> {:no_warn, Path.join(plt_dir, "typed_struct.plt")}
end
end
defp cli_env do
[
# Run mix test.watch in `:test` env.
"test.watch": :test,
# Always run Coveralls Mix tasks in `:test` env.
coveralls: :test,
"coveralls.detail": :test,
"coveralls.html": :test,
# Use a custom env for docs.
docs: :docs
]
end
defp package do
[
licenses: ["MIT"],
links: %{"GitHub" => @repo_url}
]
end
# Helper to add a development revision to the version. Do NOT make a call to
# Git this way in a production release!!
def dev do
with {rev, 0} <-
System.cmd("git", ["rev-parse", "--short", "HEAD"],
stderr_to_stdout: true
) do
"-dev+" <> String.trim(rev)
else
_ -> "-dev"
end
end
end