-
Notifications
You must be signed in to change notification settings - Fork 1
/
mix.exs
79 lines (68 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
defmodule UpsideDownLeds.MixProject do
use Mix.Project
@target System.get_env("MIX_TARGET") || "host"
def project do
[
app: :upside_down_leds,
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 UpsideDownLeds.start/2 when running on a target.
def application("host") do
[extra_applications: [:logger]]
end
def application(_target) do
[
mod: {UpsideDownLeds.Application, []},
extra_applications: [
:extwitter,
:logger,
]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[{:nerves, "~> 0.9", runtime: false}] ++ deps(@target)
end
# Specify target specific dependencies
defp deps("host"), do: []
defp deps(target) do
[
{:elixir_ale, "~> 1.0"},
{:extwitter, "~> 0.9.1"},
{:nerves_runtime, "~> 0.4"},
{:oauth, git: "https://github.com/tim/erlang-oauth.git"},
{:shoehorn, "~> 0.2"},
] ++ system(target)
end
defp system("rpi"), do: [{:nerves_system_rpi, ">= 0.0.0", runtime: false}]
defp system("rpi0"), do: [{:nerves_system_rpi0, ">= 0.0.0", runtime: false}]
defp system("rpi2"), do: [{:nerves_system_rpi2, ">= 0.0.0", runtime: false}]
defp system("rpi3"), do: [{:nerves_system_rpi3, ">= 0.0.0", runtime: false}]
defp system("bbb"), do: [{:nerves_system_bbb, ">= 0.0.0", runtime: false}]
defp system("ev3"), do: [{:nerves_system_ev3, ">= 0.0.0", runtime: false}]
defp system("qemu_arm"), do: [{:nerves_system_qemu_arm, ">= 0.0.0", runtime: false}]
defp system("x86_64"), do: [{:nerves_system_x86_64, ">= 0.0.0", runtime: false}]
defp system(target), do: Mix.raise "Unknown MIX_TARGET: #{target}"
end