diff options
author | José Valim <jose.valim@dashbit.co> | 2023-05-05 20:41:26 +0200 |
---|---|---|
committer | José Valim <jose.valim@dashbit.co> | 2023-05-05 20:41:34 +0200 |
commit | cf0d45401c761a284657a584b5bd3c9d6931f7f5 (patch) | |
tree | cd61260eb313820f59a6a55b949c06f621652523 | |
parent | 1fbdc52ed3b87451b78bdc6e93c757703c35990b (diff) | |
download | elixir-cf0d45401c761a284657a584b5bd3c9d6931f7f5.tar.gz |
Ensure children are recursively available in Mix.ensure_application!
-rw-r--r-- | lib/mix/lib/mix.ex | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/mix/lib/mix.ex b/lib/mix/lib/mix.ex index d5600aacc..e362a5508 100644 --- a/lib/mix/lib/mix.ex +++ b/lib/mix/lib/mix.ex @@ -588,16 +588,27 @@ defmodule Mix do end @doc """ - Ensures the given application from Erlang/OTP or Elixir is available in the path. + Ensures the given application from Erlang/OTP or Elixir and its dependencies + are available in the path. This is mostly used for Mix internal needs. In your own tasks, you should list the Erlang application dependencies under the `:extra_applications` section of your `mix.exs`. """ def ensure_application!(app) when is_atom(app) do - case Mix.State.builtin_apps() do + ensure_application!(app, Mix.State.builtin_apps()) + :ok + end + + defp ensure_application!(app, builtin_apps) do + case builtin_apps do %{^app => path} -> Code.prepend_path(path, cache: true) + Application.load(app) + + Application.spec(app, :applications) + |> List.wrap() + |> Enum.each(&ensure_application!(&1, builtin_apps)) %{} -> Mix.raise( |