Skip to content

Commit b65af04

Browse files
author
José Valim
committed
Load the project config just once
1 parent 0e85ec4 commit b65af04

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/mix/lib/mix/dep/loader.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Mix.Dep.Loader do
1515
current environment, behaviour can be overridden via options.
1616
"""
1717
def children() do
18-
mix_children([]) ++ Mix.Dep.Umbrella.unloaded()
18+
mix_children(Mix.Project.config(), []) ++ Mix.Dep.Umbrella.unloaded()
1919
end
2020

2121
@doc """
@@ -289,6 +289,8 @@ defmodule Mix.Dep.Loader do
289289

290290
defp mix_dep(%Mix.Dep{app: app, opts: opts} = dep, nil) do
291291
Mix.Dep.in_dependency(dep, fn _ ->
292+
config = Mix.Project.config()
293+
292294
opts =
293295
if Mix.Project.umbrella?() do
294296
Keyword.put_new(opts, :app, false)
@@ -298,14 +300,12 @@ defmodule Mix.Dep.Loader do
298300

299301
child_opts =
300302
if opts[:from_umbrella] do
301-
config = Mix.Project.config()
302-
303303
if config[:app] != app do
304304
Mix.raise(
305305
"Umbrella app #{inspect(config[:app])} is located at " <>
306-
"directory #{Atom.to_string(app)}, and different names cause " <>
307-
"a name mismatch that's not allowed. Please rename either " <>
308-
"app's directory name or app's name in mix.exs to be equal."
306+
"directory #{app}. Mix requires the directory to match " <>
307+
"the application name for umbrella apps. Please rename the " <>
308+
"directory or change the application name in the mix.exs file."
309309
)
310310
end
311311

@@ -314,7 +314,7 @@ defmodule Mix.Dep.Loader do
314314
[env: Keyword.fetch!(opts, :env)]
315315
end
316316

317-
deps = mix_children(child_opts) ++ Mix.Dep.Umbrella.unloaded()
317+
deps = mix_children(config, child_opts) ++ Mix.Dep.Umbrella.unloaded()
318318
{%{dep | opts: opts}, deps}
319319
end)
320320
end
@@ -352,10 +352,10 @@ defmodule Mix.Dep.Loader do
352352
{dep, []}
353353
end
354354

355-
defp mix_children(opts) do
355+
defp mix_children(config, opts) do
356356
from = Path.absname("mix.exs")
357357

358-
(Mix.Project.config()[:deps] || [])
358+
(config[:deps] || [])
359359
|> Enum.map(&to_dep(&1, from))
360360
|> split_by_env_and_target({opts[:env], nil})
361361
|> elem(0)

0 commit comments

Comments
 (0)