Skip to content

Commit bec7a0b

Browse files
committed
Store Mix.Dep records in Mix.Dep.deps
1 parent fe8fc1b commit bec7a0b

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

lib/mix/lib/mix/deps.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defrecord Mix.Dep, [ scm: nil, app: nil, requirement: nil, status: nil, opts: ni
99
* `requirement` - a binary or regex with the dependency's requirement
1010
* `status` - the current status of the dependency, check `Mix.Deps.format_status/1` for more info;
1111
* `opts` - the options given by the developer
12-
* `deps` - the app names of the dependencies of this dependency
12+
* `deps` - dependencies of this dependency
1313
* `manager` - the project management, possible values: `:rebar` | `:mix` | `:make` | `nil`
1414
* `from` - path to the file where the dependency was defined
1515
* `extra` - a slot for adding extra configuration based on the scm.

lib/mix/lib/mix/deps/converger.ex

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ defmodule Mix.Deps.Converger do
1515
:digraph.add_vertex(graph, app)
1616
end
1717

18-
Enum.each deps, fn Mix.Dep[app: app, deps: other_apps] ->
19-
Enum.each other_apps, fn other_app ->
18+
Enum.each deps, fn Mix.Dep[app: app, deps: other_deps] ->
19+
Enum.each other_deps, fn Mix.Dep[app: other_app] ->
2020
:digraph.add_edge(graph, other_app, app)
2121
end
2222
end
@@ -37,7 +37,7 @@ defmodule Mix.Deps.Converger do
3737
Returns all dependencies from the current project,
3838
including nested dependencies. There is a callback
3939
that is invoked for each dependency and must return
40-
an updated depedency in case some processing is done.
40+
an updated dependency in case some processing is done.
4141
"""
4242
def all(rest, callback) do
4343
main = Mix.Deps.Loader.children
@@ -94,12 +94,11 @@ defmodule Mix.Deps.Converger do
9494
# After we invoke the callback (which may actually check out the
9595
# dependency), we load the dependency including its latest info
9696
# and children information.
97-
{ dep, children } = Mix.Deps.Loader.load(dep)
98-
children = reject_non_fullfilled_optional(children, current_breadths)
99-
dep = dep.deps(Enum.map(children, &(&1.app)))
97+
dep = Mix.Deps.Loader.load(dep)
98+
dep = dep.update_deps(&reject_non_fullfilled_optional(&1, current_breadths))
10099

101100
{ acc, rest } = all(t, [dep|acc], upper_breadths, current_breadths, callback, rest)
102-
all(children, acc, current_breadths, dep.deps ++ current_breadths, callback, rest)
101+
all(dep.deps, acc, current_breadths, Enum.map(dep.deps, &(&1.app)) ++ current_breadths, callback, rest)
103102
end
104103
end
105104

lib/mix/lib/mix/deps/loader.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ defmodule Mix.Deps.Loader do
4646
{ dep, [] }
4747
end
4848

49-
{ validate_path(validate_app(dep)), children }
49+
validate_path(validate_app(dep)).deps(children)
5050
end
5151

5252
@doc """

lib/mix/lib/mix/deps/umbrella.ex

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ defmodule Mix.Deps.Umbrella do
2828
deps = unloaded
2929
apps = Enum.map(deps, &(&1.app))
3030

31-
Enum.map(deps, fn(umbrella_dep) ->
32-
{ umbrella_dep, deps } = Mix.Deps.Loader.load(umbrella_dep)
33-
deps = lc Mix.Dep[] = dep inlist deps,
34-
Mix.Deps.available?(dep),
35-
dep.app in apps,
36-
do: dep.app
31+
Enum.map(deps, fn umbrella_dep ->
32+
umbrella_dep = Mix.Deps.Loader.load(umbrella_dep)
33+
deps = Enum.filter(umbrella_dep.deps, fn Mix.Dep[] = dep ->
34+
Mix.Deps.available?(dep) and dep.app in apps
35+
end)
3736
umbrella_dep.deps(deps)
3837
end) |> Mix.Deps.Converger.topsort
3938
end

0 commit comments

Comments
 (0)