-
Notifications
You must be signed in to change notification settings - Fork 3
/
mix.exs
72 lines (61 loc) · 2 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
defmodule Scanner.MixProject do
use Mix.Project
@target System.get_env("MIX_TARGET") || "host"
def project do
[
app: :scanner,
version: "0.1.0",
elixir: "~> 1.4",
target: @target,
archives: [nerves_bootstrap: "~> 0.8"],
deps_path: "deps/#{@target}",
build_path: "_build/#{@target}",
lockfile: "mix.lock.#{@target}",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: ["loadconfig": [&bootstrap/1]],
deps: deps()
]
end
# Starting nerves_bootstrap adds the required aliases to Mix.Project.config()
# Aliases are only added if MIX_TARGET is set.
def bootstrap(args) do
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
# Run "mix help compile.app" to learn about applications.
def application, do: application(@target)
# Specify target specific application configurations
# It is common that the application start function will start and supervise
# applications which could cause the host to fail. Because of this, we only
# invoke Scanner.start/2 when running on a target.
def application("host") do
[extra_applications: [:logger]]
end
def application(_target) do
[mod: {Scanner.Application, []}, extra_applications: [:logger]]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:nerves, "~> 0.9", runtime: false},
{:nerves_uart, "~> 1.2"},
{:nerves_init_gadget, "~> 0.2"},
{:ring_logger, "~> 0.4"},
{:httpoison, "~> 1.0"},
{:poison, "~> 3.1"}
] ++ deps(@target)
end
# Specify target specific dependencies
defp deps("host"), do: []
defp deps(target) do
[
{:shoehorn, "~> 0.2"},
{:nerves_runtime, "~> 0.4"},
{:nerves_network, "~> 0.3"},
{:nerves_firmware_ssh, "~> 0.2"}
] ++ system(target)
end
defp system("rpi0"), do: [{:nerves_system_rpi0, ">= 0.0.0", runtime: false}]
defp system(target), do: Mix.raise "Unknown MIX_TARGET: #{target}"
end