forked from E-xyza/zigler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
97 lines (89 loc) · 3.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
defmodule Zigler.MixProject do
use Mix.Project
# for the Zig application, tests are divided into two groups: Unit tests
# are all tests which don't require any sort of zig compilation and
# integration tests are all tests which do.
#
# `mix test` will run the full suite of tests.
# `mix test.unit` will only run the unit tests.
def project do
env = Mix.env()
if Mix.env in [:unit, :isolated] do
# elixir doesn't allow us to run tests in any environment besides `:test`.
# so if we send ourselves into the unit tests, we'll have to ninja
# ourselves back into the test environment.
Mix.env(:test)
end
[
app: :zigler,
version: "0.7.3",
elixir: "~> 1.9",
start_permanent: env == :prod,
elixirc_paths: elixirc_paths(env),
deps: deps(),
aliases: [docs: "zig_doc", "test.unit": "test", "test.isolated": "test"],
aliases: ["test.unit": "test", "test.isolated": "test"],
package: [
description: "Zig nif library",
licenses: ["MIT"],
# we need to package the zig BEAM adapters and the c include files as a part
# of the hex packaging system.
files: ~w(lib mix.exs README* LICENSE* VERSIONS* priv),
links: %{"GitHub" => "https://github.com/ityonemo/zigler", "Zig" => "https://ziglang.org/"}
],
dialyzer: [plt_add_deps: :transitive],
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
"test.unit": :unit,
"test.isolated": :isolated,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
dialyzer: :dev],
test_paths: test_paths(env),
source_url: "https://github.com/ityonemo/zigler/",
docs: [
main: "Zig",
extras: ["README.md", "guides/nifs.md", "guides/resources.md"],
groups_for_extras: ["Guides": Path.wildcard("guides/*.md")],
groups_for_modules: ["Under the hood": under_the_hood()]]
]
end
def under_the_hood do
[Zig.Assembler, Zig.Code, Zig.Code.LongRunning, Zig.Compiler,
Zig.Module, Zig.Parser, Zig.Typespec, Zig.Command, Zig.Doc.Parser,
Zig.Doc.Retriever, Zig.Parser.Error, Zig.Parser.Imports,
Zig.Patches, Zig.Parser.Unit, Zig.Parser.Resource,
Zig.Parser.ResourceCleanup, Zig.Parser.Nif, Zig.Parser]
end
def application, do: [extra_applications: [:logger]]
defp elixirc_paths(:dev), do: ["lib"]
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(:unit), do: ["lib"]
defp elixirc_paths(:isolated), do: ["lib", "test/isolated/support"]
defp elixirc_paths(_), do: ["lib"]
# running `mix test` executes both integration tests and unit tests.
# running `mix test.unit` executes just the unit tests.
# comment-twiddle next lines to run a single test in isolation
defp test_paths(:test), do: ["test/integration", "test/unit"]
defp test_paths(:unit), do: ["test/unit"]
defp test_paths(:isolated), do: ["test/isolated"]
defp test_paths(_), do: []
def deps do
[
# credo
{:credo, "~> 1.4.0", only: [:dev, :test], runtime: false},
# dialyzer
{:dialyxir, "~> 0.5", only: [:dev], runtime: false},
# coverage testing
{:excoveralls, "~> 0.12", only: :test, runtime: false},
# zigler's parsing is done using nimble_parsec
{:nimble_parsec, "~> 1.1", runtime: false},
# to parse the zig JSON
{:jason, "~> 1.1", runtime: false},
# documentation
{:ex_doc, "~> 0.23", runtime: false},
]
end
end