forked from E-xyza/zigler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
111 lines (100 loc) · 2.67 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 Zigler.MixProject do
use Mix.Project
def project do
env = Mix.env()
[
app: :zigler,
version: "0.11.1-pre-2",
elixir: "~> 1.13",
start_permanent: env == :prod,
elixirc_paths: elixirc_paths(env),
deps: deps(),
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/beam],
links: %{
"GitHub" => "https://github.com/E-xyza/zigler",
"Zig" => "https://ziglang.org/"
}
],
dialyzer: [plt_add_deps: :transitive],
preferred_cli_env: [dialyzer: :dev],
source_url: "https://github.com/E-xyza/zigler/",
docs: docs(),
aliases: [docs: "zig_doc"]
]
end
defp docs do
[
main: "Zig",
extras: ["README.md" | guides(Mix.env())],
groups_for_extras: [Guides: Path.wildcard("guides/*.md")],
groups_for_modules: [
"Compilation Steps": compilation_steps(),
Types: ~r/Zig\.Type(^\.ParseError)/,
"Nif Modes": [~r/Zig\.Nif.+/, Zig.EasyC],
"Data Structures": data_structures(),
tools: tools()
],
zig_doc: [beam: [file: "priv/beam/beam.zig"]]
]
end
defp guides(:dev) do
"guides"
|> File.ls!()
|> Enum.sort()
|> Enum.filter(&String.ends_with?(&1, ".md"))
|> Enum.map(&Path.join("guides", &1))
end
defp guides(_), do: []
defp compilation_steps do
[
Zig.Assembler,
Zig.Builder,
Zig.Command,
Zig.Compiler,
Zig.Sema
]
end
defp data_structures do
[
Zig.Module,
Zig.Nif,
Zig.Manifest,
Zig.Resources
]
end
defp tools do
[
Zig.Analyzer,
Zig.Macro,
Zig.Options,
Zig.QuoteErl,
Zig.ErrorProng,
Zig.Target
]
end
def application, do: [extra_applications: [:logger, :inets, :crypto, :public_key, :ssl]]
defp elixirc_paths(:dev), do: ["lib"]
defp elixirc_paths(:test), do: ["lib", "test/_support"]
defp elixirc_paths(_), do: ["lib"]
def deps do
[
# credo
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
# dialyzer
{:dialyxir, "~> 0.5", only: [:dev], runtime: false},
# to parse the zig JSON
{:jason, "~> 1.4"},
# zig parser is pinned to a version of zig parser because versions of zig parser
# are pinned to zig versions
{:zig_parser, "~> 0.3.0"},
# documentation
{:ex_doc, "~> 0.30.0", only: :dev, runtime: false},
{:zig_doc, "~> 0.3.1", only: :dev, runtime: false}
]
end
end