defmodule NervesSystemVultr.MixProject do use Mix.Project @github_organization "nerves-project" @app :nerves_system_vultr @version Path.join(__DIR__, "VERSION") |> File.read!() |> String.trim() def project do [ app: @app, version: @version, elixir: "~> 1.6", compilers: Mix.compilers() ++ [:nerves_package], nerves_package: nerves_package(), description: description(), package: package(), deps: deps(), aliases: [loadconfig: [&bootstrap/1]], docs: [extras: ["README.md"], main: "readme"] ] end def application do [] end defp bootstrap(args) do set_target() Application.start(:nerves_bootstrap) Mix.Task.run("loadconfig", args) end defp nerves_package do [ type: :system, artifact_sites: [ {:github_releases, "#{@github_organization}/#{@app}"} ], platform: Nerves.System.BR, platform_config: [ defconfig: "nerves_defconfig" ], checksum: package_files() ] end defp deps do [ {:nerves, "~> 1.5.4 or ~> 1.6.0", runtime: false}, {:nerves_system_br, "1.12.4", runtime: false}, {:nerves_toolchain_x86_64_unknown_linux_musl, "~> 1.3.0", runtime: false}, {:nerves_system_linter, "~> 0.4", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.18", only: [:dev, :test], runtime: false} ] end defp description do """ Nerves System - Vultr """ end defp package do [ files: package_files(), licenses: ["Apache 2.0"], links: %{"GitHub" => "https://github.com/#{@github_organization}/#{@app}"} ] end defp package_files do [ "fwup_include", "rootfs_overlay", "CHANGELOG.md", "fwup-revert.conf", "fwup.conf", "grub.cfg", "LICENSE", "linux-4.19.defconfig", "mix.exs", "nerves_defconfig", "post-createfs.sh", "post-build.sh", "README.md", "VERSION" ] end defp set_target() do if function_exported?(Mix, :target, 1) do apply(Mix, :target, [:target]) else System.put_env("MIX_TARGET", "target") end end end