forked from FarmBot/farmbot_os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmix.exs
204 lines (184 loc) · 5.28 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
defmodule Farmbot.Mixfile do
use Mix.Project
@target System.get_env("MIX_TARGET") || "host"
@version Path.join(__DIR__, "VERSION") |> File.read!() |> String.trim()
defp commit do
System.cmd("git", ~w"rev-parse --verify HEAD") |> elem(0) |> String.trim()
end
defp arduino_commit do
opts = [cd: "c_src/farmbot-arduino-firmware"]
System.cmd("git", ~w"rev-parse --verify HEAD", opts)
|> elem(0)
|> String.trim()
end
def project do
[
app: :farmbot,
description: "The Brains of the Farmbot Project",
elixir: "~> 1.6",
package: package(),
make_clean: ["clean"],
make_env: make_env(),
compilers: [:elixir_make] ++ Mix.compilers(),
test_coverage: [tool: ExCoveralls],
version: @version,
target: @target,
commit: commit(),
arduino_commit: arduino_commit(),
archives: [nerves_bootstrap: "~> 1.0.0"],
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps_path: "deps/#{@target}",
build_path: "_build/#{@target}",
lockfile: "mix.lock.#{@target}",
config_path: "config/config.exs",
elixirc_paths: elixirc_paths(Mix.env(), @target),
aliases: aliases(Mix.env(), @target),
deps: deps() ++ deps(@target),
dialyzer: [
plt_add_deps: :transitive,
plt_add_apps: [:mix],
flags: []
],
preferred_cli_env: [
test: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.circle": :test
],
source_url: "https://github.com/Farmbot/farmbot_os",
homepage_url: "http://farmbot.io",
docs: docs()
]
end
def application do
[
mod: {Farmbot, []},
extra_applications: [:logger, :eex, :ssl, :inets, :runtime_tools]
]
end
defp docs do
[
main: "building",
logo: "priv/static/farmbot_logo.png",
source_ref: commit(),
extras: [
"docs/BUILDING.md",
"docs/FAQ.md",
"README.md",
"CHANGELOG.md",
"CONTRIBUTING.md"
]
]
end
defp make_env do
case System.get_env("ERL_EI_INCLUDE_DIR") do
nil ->
%{
"ERL_EI_INCLUDE_DIR" => Path.join([:code.root_dir(), "usr", "include"]),
"ERL_EI_LIBDIR" => Path.join([:code.root_dir(), "usr", "lib"]),
"MIX_TARGET" => @target
}
_ ->
%{}
end
end
defp deps do
[
{:nerves, "~> 1.1", runtime: false},
{:elixir_make, "~> 0.4.2", runtime: false},
{:gen_stage, "~> 0.14.0"},
{:phoenix_html, "~> 2.11"},
{:poison, "~> 3.1.0"},
{:jason, "~> 1.1"},
{:httpoison, "~> 1.2"},
{:jsx, "~> 2.8"},
{:timex, "~> 3.3"},
{:fs, "~> 3.4"},
{:nerves_uart, "~> 1.2"},
{:nerves_leds, "~> 0.8"},
{:cowboy, "~> 2.0"},
{:plug, "~> 1.6"},
{:ranch_proxy_protocol, "~> 2.0", override: true},
{:cors_plug, "~> 1.5"},
{:rsa, "~> 0.0.1"},
{:joken, "~> 1.5"},
{:sqlite_ecto2, "~> 2.2.4"},
{:uuid, "~> 1.1"},
{:socket, "~> 0.3.13"},
{:amqp, "~> 1.0"},
{:recon, "~> 2.3.2"},
{:ring_logger, "~> 0.4.1"},
{:bbmustache, "~> 1.5"},
{:apex, "~> 1.2"},
{:logger_backend_ecto, "~> 1.2"}
]
end
defp deps("host") do
[
{:ex_doc, "~> 0.18", only: :dev},
{:excoveralls, "~> 0.9", only: :test},
{:dialyxir, "~> 1.0.0-rc.3", only: :dev, runtime: false},
{:credo, "~> 0.9.3", only: [:dev, :test], runtime: false},
{:inch_ex, "~> 0.5", only: :dev},
{:mock, "~> 0.3.1", only: :test},
{:faker, "~> 0.10", only: :test}
]
end
defp deps(target) do
system(target) ++
[
{:shoehorn, "~> 0.3", except: :test},
{:nerves_runtime, "~> 0.6.1"},
{:nerves_firmware, "~> 0.4"},
{:nerves_firmware_ssh, "~> 0.3.3"},
{:nerves_init_gadget, "~> 0.4.0", only: :dev},
{:nerves_time, "~> 0.2.0"},
{:nerves_network, "~> 0.3"},
{:nerves_wpa_supplicant, github: "nerves-project/nerves_wpa_supplicant", override: true},
{:dhcp_server, "~> 0.4.0"},
{:elixir_ale, "~> 1.0"},
{:mdns, "~> 1.0"}
]
end
defp system("rpi3"),
do: [{:nerves_system_farmbot_rpi3, "1.3.0-farmbot.2", runtime: false}]
defp package do
[
name: "farmbot",
maintainers: ["Farmbot.io"],
licenses: ["MIT"],
links: %{"github" => "https://github.com/farmbot/farmbot_os"}
]
end
defp elixirc_paths(:test, "host") do
["./lib", "./platform/host", "./test/support"]
end
defp elixirc_paths(_, "host") do
["./lib", "./platform/host"]
end
defp elixirc_paths(_env, _target) do
["./lib", "./platform/target"]
end
defp aliases(:test, "host") do
[test: ["ecto.drop", "ecto.create --quiet", "ecto.migrate", "test"]]
end
defp aliases(_env, "host"),
do: [
"firmware.slack": ["farmbot.firmware.slack"],
"firmware.sign": ["farmbot.firmware.sign"]
]
defp aliases(_env, _system) do
[
"firmware.slack": ["farmbot.firmware.slack"],
"firmware.sign": ["farmbot.firmware.sign"],
loadconfig: [&bootstrap/1]
]
end
defp bootstrap(args) do
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
end