-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmix.exs
127 lines (115 loc) · 2.86 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
126
127
defmodule GrpcReflection.MixProject do
use Mix.Project
@version "0.1.5"
@source_url "https://github.com/elixir-grpc/grpc-reflection"
@description "gRPC reflection server for Elixir"
def project do
[
app: :grpc_reflection,
version: @version,
description: @description,
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
docs: docs(),
aliases: aliases(),
test_coverage: [
ignore_modules: [
~r/^Grpc\./,
~r/^Helloworld\./,
~r/^TestserviceV2\./,
~r/^TestserviceV3\./,
GrpcReflection.TestEndpoint,
GrpcReflection.TestEndpoint.Endpoint
]
],
dialyzer: dialyzer()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:grpc, "~> 0.9"},
{:protobuf, "~> 0.14"}
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp aliases do
[
build_protos: [&build_protos/1],
check: ["dialyzer", "credo --strict"]
]
end
defp build_protos(_argv) do
options =
Enum.join(
[
"gen_descriptors=true",
"plugins=grpc",
"include_docs=true"
],
","
)
Enum.each(
[
"priv/protos/grpc/reflection/v1alpha/reflection.proto",
"priv/protos/grpc/reflection/v1/reflection.proto"
],
fn reflection_proto ->
Mix.shell().cmd(
"protoc --elixir_out=#{options}:./lib/proto --proto_path=priv/protos/ #{reflection_proto}"
)
end
)
Enum.each(
[
"priv/protos/test_service_v2.proto",
"priv/protos/test_service_v3.proto"
],
fn reflection_proto ->
Mix.shell().cmd(
"protoc --elixir_out=#{options}:./test/support/protos --proto_path=priv/protos/ #{reflection_proto}"
)
end
)
end
defp package do
%{
name: "grpc_reflection",
files: ~w(.formatter.exs mix.exs lib),
links: %{"GitHub" => @source_url},
licenses: ["Apache-2.0"]
}
end
defp docs do
[
extras: [
"README.md": [title: "Overview"]
],
main: "readme",
source_url: @source_url,
source_ref: "#{@version}",
formatters: ["html"]
]
end
defp dialyzer do
[
plt_local_path: "priv/plts/project",
plt_core_path: "priv/plts/core",
plt_add_apps: [:ex_unit],
list_unused_filters: true
]
end
end