Permalink
Browse files

Merge pull request #59 from nerves-project/distillery

Distillery support
  • Loading branch information...
mobileoverlord committed Dec 12, 2016
2 parents 873590a + 29de772 commit c58e1b9f390a348aa11a98f96548829146db4589
Showing with 80 additions and 62 deletions.
  1. +5 −2 lib/mix/tasks/firmware.ex
  2. +18 −0 lib/mix/tasks/nerves.release.init.ex
  3. +0 −50 lib/nerves/release.ex
  4. +1 −1 mix.exs
  5. +2 −9 mix.lock
  6. +54 −0 priv/templates/release.eex
@@ -43,7 +43,7 @@ defmodule Mix.Tasks.Firmware do
Environment variable $NERVES_TOOLCHAIN is not set
"""
Mix.Task.run "compile", []
Mix.Task.run "release", ["--verbosity=#{verbosity}", "--no-confirm-missing", "--implode"]
Mix.Task.run "release", ["--verbosity=#{verbosity}"]
rel2fw_path = Path.join(system_path, "scripts/rel2fw.sh")
cmd = "bash"
@@ -65,7 +65,10 @@ defmodule Mix.Tasks.Firmware do
["-c", fw_conf]
end
fw = ["-f", "_images/#{target}/#{otp_app}.fw"]
output = ["rel/#{otp_app}"]
release_path =
Mix.Project.build_path()
|> Path.join("rel/#{otp_app}")
output = [release_path]
args = args ++ fwup_conf ++ rootfs_additions ++ fw ++ output
shell(cmd, args)
@@ -0,0 +1,18 @@
defmodule Mix.Tasks.Nerves.Release.Init do
use Mix.Task
@moduledoc """
Prepares a new project for use with releases.
By default, this forwards the call to
mix release.init --template /path/to/nerves/release_template.eex
For more information on additional args, reference
mix help release.init
"""
@spec run(OptionParser.argv) :: no_return
def run(args) do
template_path = Path.join(["#{:code.priv_dir(:nerves)}", "templates", "release.eex"])
Mix.Task.run("release.init", args ++ ["--template", template_path])
end
end

This file was deleted.

Oops, something went wrong.
@@ -25,7 +25,7 @@ defmodule Nerves.Mixfile do
defp deps do
[
{:exrm, "~> 1.0.6"},
{:distillery, "~> 1.0.0"},
{:earmark, "~> 1.0", only: :dev},
{:ex_doc, "~> 0.14", only: :dev}
]
@@ -1,10 +1,3 @@
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [], []},
"cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [], []},
%{"distillery": {:hex, :distillery, "1.0.0", "a866a72bf2a3a5f078f5a249017ed951acda88a760d200512f91f585d74db1ec", [:mix], []},
"earmark": {:hex, :earmark, "1.0.3", "89bdbaf2aca8bbb5c97d8b3b55c5dd0cff517ecc78d417e87f1d0982e514557b", [:mix], []},
"erlware_commons": {:hex, :erlware_commons, "0.21.0", "a04433071ad7d112edefc75ac77719dd3e6753e697ac09428fc83d7564b80b15", [], [{:cf, "0.2.1", [hex: :cf, optional: false]}]},
"ex_doc": {:hex, :ex_doc, "0.14.3", "e61cec6cf9731d7d23d254266ab06ac1decbb7651c3d1568402ec535d387b6f7", [], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
"exrm": {:hex, :exrm, "1.0.8", "5aa8990cdfe300282828b02cefdc339e235f7916388ce99f9a1f926a9271a45d", [:mix], [{:relx, "~> 3.5", [hex: :relx, optional: false]}]},
"getopt": {:hex, :getopt, "0.8.2", "b17556db683000ba50370b16c0619df1337e7af7ecbf7d64fbf8d1d6bce3109b", [], []},
"porcelain": {:hex, :porcelain, "2.0.1", "9c3db2b47d8cf6879c0d9ac79db8657333974a88faff09e856569e00c1b5e119", [:mix], []},
"providers": {:hex, :providers, "1.6.0", "db0e2f9043ae60c0155205fcd238d68516331d0e5146155e33d1e79dc452964a", [], [{:getopt, "0.8.2", [hex: :getopt, optional: false]}]},
"relx": {:hex, :relx, "3.21.1", "f989dc520730efd9075e9f4debcb8ba1d7d1e86b018b0bcf45a2eb80270b4ad6", [:rebar3], [{:bbmustache, "1.0.4", [hex: :bbmustache, optional: false]}, {:cf, "0.2.1", [hex: :cf, optional: false]}, {:erlware_commons, "0.21.0", [hex: :erlware_commons, optional: false]}, {:getopt, "0.8.2", [hex: :getopt, optional: false]}, {:providers, "1.6.0", [hex: :providers, optional: false]}]}}
"ex_doc": {:hex, :ex_doc, "0.14.5", "c0433c8117e948404d93ca69411dd575ec6be39b47802e81ca8d91017a0cf83c", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]}}
@@ -0,0 +1,54 @@
use Mix.Releases.Config,
# This sets the default release built by `mix release`
default_release: :default,
# This sets the default environment used by `mix release`
default_environment: :dev
<%= unless no_docs do %>
# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/configuration.html
<% end %>
<%= unless no_docs do %>
# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile
<% end %>
environment :dev do
set cookie: <%= inspect(cookie) %>
end
environment :prod do
set cookie: <%= inspect(cookie) %>
end
<%= unless no_docs do %>
# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default<% end %>
<%= for release <- releases do %><%= if Keyword.get(release, :is_umbrella) do %>
release :<%= Keyword.get(release, :release_name) %> do
set version: "0.1.0"
set applications: [
<%= Enum.map(Keyword.get(release, :release_applications), fn {app, start_type} ->
" #{app}: :#{start_type}"
end) |> Enum.join(",\n") %>
]
if System.get_env("NERVES_SYSTEM") do
set dev_mode: false
set include_src: false
set include_erts: System.get_env("ERL_LIB_DIR")
set include_system_libs: System.get_env("ERL_SYSTEM_LIB_DIR")
set vm_args: "rel/vm.args"
end
end<% else %>
release :<%= Keyword.get(release, :release_name) %> do
set version: current_version(:<%= Keyword.get(release, :release_name)%>)
if System.get_env("NERVES_SYSTEM") do
set dev_mode: false
set include_src: false
set include_erts: System.get_env("ERL_LIB_DIR")
set include_system_libs: System.get_env("ERL_SYSTEM_LIB_DIR")
set vm_args: "rel/vm.args"
end
end<% end %>
<% end %>

0 comments on commit c58e1b9

Please sign in to comment.