This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mix.exs
96 lines (83 loc) · 2.51 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
defmodule OpentelemetryTelemetry.MixProject do
use Mix.Project
def project do
{app, desc} = load_app()
config = load_config()
[
app: app,
version: version(Keyword.fetch!(desc, :vsn)),
description: to_string(Keyword.fetch!(desc, :description)),
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps(Keyword.fetch!(config, :deps)),
name: "Opentelemetry Telemetry",
source_url: "https://github.com/opentelemetry-beam/opentelemetry_telemetry",
docs: [
markdown_processor: ExDoc.Markdown.Earmark,
main: "OpentelemetryTelemetry",
# logo: "path/to/logo.png",
# erlang_docs()
extras: []
],
aliases: [
# when build docs first build edocs with rebar3
docs: ["cmd rebar3 edoc", "docs"]
],
package: package()
]
end
defp version(version) when is_list(version) do
List.to_string(version)
end
defp version({:file, path}) do
path
|> File.read!()
|> String.trim()
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp deps(rebar) do
rebar
|> Enum.map(fn
{dep, version} -> {dep, to_string(version)}
dep when is_atom(dep) -> {dep, ">= 0.0.0"}
end)
|> Enum.concat([
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.25.3", only: :dev, runtime: false},
{:opentelemetry, "~> 1.0.0-rc.3", only: [:dev, :test]},
{:opentelemetry_exporter, "~> 1.0.0-rc.3", only: [:dev, :test]}
])
end
defp package() do
[
description: "Bridge library between Telemetry events and OpenTelemetry Erlang",
build_tools: ["rebar3", "mix"],
files: ~w(lib mix.exs README.md LICENSE CODEOWNERS rebar.config rebar.lock VERSION src),
licenses: ["Apache-2.0"],
links: %{
"GitHub" => "https://github.com/opentelemetry-beam/opentelemetry_telemetry",
"OpenTelemetry.io" => "https://opentelemetry.io"
}
]
end
def erlang_docs() do
files =
for file <- Path.wildcard("edoc/*.md"),
file != "edoc/README.md",
do: {String.to_atom(file), [title: Path.basename(file, ".md")]}
[{:"README.md", [title: "Overview"]} | files]
end
defp load_config do
{:ok, config} = :file.consult('rebar.config')
config
end
defp load_app do
{:ok, [{:application, name, desc}]} = :file.consult('src/opentelemetry_telemetry.app.src')
{name, desc}
end
end