diff --git a/lib/bundlex.ex b/lib/bundlex.ex index 8eb1c04..35e1472 100644 --- a/lib/bundlex.ex +++ b/lib/bundlex.ex @@ -19,6 +19,7 @@ defmodule Bundlex do """ @type target :: %{architecture: String.t(), vendor: String.t(), os: String.t(), abi: String.t() | nil} + @doc """ A function returning a target triplet for the environment on which it is run. """ diff --git a/lib/bundlex/loader.ex b/lib/bundlex/loader.ex index 466e6bd..81bb47f 100644 --- a/lib/bundlex/loader.ex +++ b/lib/bundlex/loader.ex @@ -74,9 +74,7 @@ defmodule Bundlex.Loader do @moduledoc false require unquote(__MODULE__) - if unquote(Mix.target() == :host) do - @on_load :load_nif - end + @on_load :load_nif @spec load_nif() :: :ok | no_return() def load_nif() do diff --git a/lib/bundlex/platform.ex b/lib/bundlex/platform.ex index 60fb2aa..bb80f1b 100644 --- a/lib/bundlex/platform.ex +++ b/lib/bundlex/platform.ex @@ -41,17 +41,14 @@ defmodule Bundlex.Platform do Otherwise raises Mix error. """ @spec get_target!() :: name_t - def get_target!() do - case {Mix.target(), System.fetch_env("NERVES_APP")} do - {:host, _app} -> - get_host!() - - {_target, {:ok, _app}} -> - :nerves - - {_target, :error} -> - IO.warn("Crosscompilation supported only for Nerves systems, assuming host's platform") - get_host!() + if Mix.target() == :host do + def get_target!(), do: get_host!() + else + def get_target!() do + case System.fetch_env("NERVES_APP") do + {:ok, _app} -> :nerves + :error -> get_host!() + end end end diff --git a/mix.exs b/mix.exs index 2ef652a..3afad72 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Bundlex.Mixfile do use Mix.Project - @version "1.4.2" + @version "1.4.3" @github_url "https://github.com/membraneframework/bundlex" def project do