Skip to content

Commit d525b0f

Browse files
committed
Merge pull request #2197 from ericmj/remote-converger-filter
Don't load dependencies in remote converger
2 parents c2c1ebd + a1ff5b6 commit d525b0f

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

lib/mix/lib/mix/cli.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule Mix.CLI do
2626
run_task(task, args)
2727
end
2828

29-
@hex_requirement ">= 0.1.0-dev"
29+
@hex_requirement ">= 0.1.1-dev"
3030

3131
defp load_remote do
3232
if Code.ensure_loaded?(Hex) do

lib/mix/lib/mix/dep/converger.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ defmodule Mix.Dep.Converger do
7676
|> Enum.into(HashDict.new, &{&1.app, &1})
7777

7878
# In case there is no lock, we will read the current lock
79-
# which is potentially stale. So converger.deps needs to
80-
# always check if the data it finds on the lock is actually
79+
# which is potentially stale. So converger.deps/2 needs to
80+
# always check if the data it finds in the lock is actually
8181
# valid.
8282
lock_for_converger = lock || Mix.Dep.Lock.read
8383

@@ -148,7 +148,8 @@ defmodule Mix.Dep.Converger do
148148
# After we invoke the callback (which may actually check out the
149149
# dependency), we load the dependency including its latest info
150150
# and children information.
151-
Mix.Dep.Loader.load(dep, children)
151+
dep = Mix.Dep.Loader.load(dep)
152+
%{dep | deps: Enum.filter(dep.deps, &(!children || &1.app in children))}
152153
end
153154

154155
dep = %{dep | deps: reject_non_fullfilled_optional(dep.deps, current_breadths)}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,33 @@ defmodule Mix.Dep.Loader do
3636
Loads the given dependency information, including its
3737
latest status and children.
3838
"""
39-
def load(dep, children) do
39+
def load(dep) do
4040
%Mix.Dep{manager: manager, scm: scm, opts: opts} = dep
4141
dep = %{dep | status: scm_status(scm, opts)}
4242
dest = opts[:dest]
4343

4444
{dep, children} =
4545
cond do
4646
not ok?(dep.status) ->
47-
{dep, children}
47+
{dep, []}
4848

4949
manager == :rebar ->
50-
rebar_dep(dep, children)
50+
rebar_dep(dep)
5151

5252
mix?(dest) ->
53-
mix_dep(%{dep | manager: :mix}, children)
53+
mix_dep(%{dep | manager: :mix})
5454

5555
rebar?(dest) ->
56-
rebar_dep(%{dep | manager: :rebar}, children)
56+
rebar_dep(%{dep | manager: :rebar})
5757

5858
make?(dest) ->
59-
{%{dep | manager: :make}, children}
59+
{%{dep | manager: :make}, []}
6060

6161
true ->
62-
{dep, children}
62+
{dep, []}
6363
end
6464

65-
%{validate_path(validate_app(dep)) | deps: children || []}
65+
%{validate_path(validate_app(dep)) | deps: children}
6666
end
6767

6868
@doc """
@@ -205,7 +205,7 @@ defmodule Mix.Dep.Loader do
205205

206206
## Fetching
207207

208-
defp mix_dep(%Mix.Dep{opts: opts} = dep, children) do
208+
defp mix_dep(%Mix.Dep{opts: opts} = dep) do
209209
Mix.Dep.in_dependency(dep, fn _ ->
210210
config = Mix.project
211211
umbrella? = Mix.Project.umbrella?
@@ -220,16 +220,16 @@ defmodule Mix.Dep.Loader do
220220
end
221221

222222
dep = %{dep | manager: :mix, opts: opts, extra: [umbrella: umbrella?]}
223-
{dep, children || children(env: opts[:env] || :prod)}
223+
{dep, children(env: opts[:env] || :prod)}
224224
end)
225225
end
226226

227-
defp rebar_dep(%Mix.Dep{} = dep, children) do
227+
defp rebar_dep(%Mix.Dep{} = dep) do
228228
Mix.Dep.in_dependency(dep, fn _ ->
229229
rebar = Mix.Rebar.load_config(".")
230230
extra = Dict.take(rebar, [:sub_dirs])
231231
dep = %{dep | manager: :rebar, extra: extra}
232-
{dep, children || rebar_children(rebar)}
232+
{dep, rebar_children(rebar)}
233233
end)
234234
end
235235

lib/mix/lib/mix/dep/umbrella.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defmodule Mix.Dep.Umbrella do
2929
apps = Enum.map(deps, &(&1.app))
3030

3131
Enum.map(deps, fn umbrella_dep ->
32-
umbrella_dep = Mix.Dep.Loader.load(umbrella_dep, nil)
32+
umbrella_dep = Mix.Dep.Loader.load(umbrella_dep)
3333
deps = Enum.filter(umbrella_dep.deps, fn dep ->
3434
Mix.Dep.available?(dep) and dep.app in apps
3535
end)

lib/mix/lib/mix/remote_converger.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ defmodule Mix.RemoteConverger do
2020
defcallback converge([Mix.Dep.t], map) :: map
2121

2222
@doc """
23-
Returns a loaded list of child dependencies the converger has
24-
for the dependency. This list should override what is specified
25-
in mix.exs or rebar.config.
23+
Returns a child dependencies the converger has for the
24+
dependency. This list should filter the loaded children.
2625
"""
27-
defcallback deps(Mix.Dep.t, map) :: [Mix.Dep.t]
26+
defcallback deps(Mix.Dep.t, map) :: [atom]
2827

2928

3029
@doc """

0 commit comments

Comments
 (0)