Skip to content

Commit 494bded

Browse files
author
José Valim
committed
deps.check -> deps.loadpaths
deps.loadpaths was public API that Nerves, in particular, depended on. This commit brings back the deps.loadpaths task, replacing the incorrect deps.check that should not be required by Nerves.
1 parent 2b0fc52 commit 494bded

File tree

12 files changed

+35
-33
lines changed

12 files changed

+35
-33
lines changed

lib/mix/lib/mix/dep.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ defmodule Mix.Dep do
6464
@doc """
6565
Returns loaded dependencies from the cache for the current environment.
6666
67-
Because the dependencies are cached during deps.check, their
67+
Because the dependencies are cached during deps.loadpaths, their
6868
status may be outdated (for example, `:compile` did not
6969
yet become `:ok`). Therefore it is recommended to not rely
7070
on their status, also given they haven't been checked

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ defmodule Mix.Dep.Converger do
8484
if not diverged? && remote do
8585
# If there is a lock, it means we are doing a get/update
8686
# and we need to hit the remote converger which do external
87-
# requests and what not. In case of deps.check, deps and so
87+
# requests and what not. In case of deps.loadpaths, deps and so
8888
# on, there is no lock, so we won't hit this branch.
8989
lock = if lock_given?, do: remote.converge(deps, lock), else: lock
9090

lib/mix/lib/mix/task.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ defmodule Mix.Task do
275275
# 2. Otherwise we look for it in dependencies.
276276
# 3. Finally, we compile the current project in hope it is available.
277277
module =
278-
get_task_or_run(proj, task, fn -> Mix.Task.run("deps.check") end) ||
278+
get_task_or_run(proj, task, fn -> Mix.Task.run("deps.loadpaths") end) ||
279279
get_task_or_run(proj, task, fn -> Mix.Project.compile([]) end) ||
280280
get!(task)
281281

lib/mix/lib/mix/tasks/clean.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ defmodule Mix.Tasks.Clean do
4949
defp loadpaths! do
5050
Mix.Task.run "loadpaths", ["--no-elixir-version-check", "--no-deps-check", "--no-archives-check"]
5151
Mix.Task.reenable "loadpaths"
52-
Mix.Task.reenable "deps.check"
52+
Mix.Task.reenable "deps.loadpaths"
5353
end
5454
end

lib/mix/lib/mix/tasks/compile.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ defmodule Mix.Tasks.Compile do
9595
defp loadpaths! do
9696
Mix.Task.run "loadpaths", ["--no-elixir-version-check", "--no-deps-check", "--no-archives-check"]
9797
Mix.Task.reenable "loadpaths"
98-
Mix.Task.reenable "deps.check"
98+
Mix.Task.reenable "deps.loadpaths"
9999
end
100100

101101
defp consolidate_protocols? do

lib/mix/lib/mix/tasks/deps.check.ex renamed to lib/mix/lib/mix/tasks/deps.loadpaths.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
defmodule Mix.Tasks.Deps.Check do
1+
defmodule Mix.Tasks.Deps.Loadpaths do
22
use Mix.Task
33

44
import Mix.Dep, only: [loaded_by_name: 2, format_dep: 1, ok?: 1,
55
format_status: 1, check_lock: 1]
66

77
@moduledoc """
8-
Checks if all dependencies are valid,
9-
loading them along the way.
8+
Checks and loads all dependencies along the way.
109
1110
If there is an invalid dependency, its status is printed
1211
before aborting.
1312
13+
Although this task does not show up in `mix help`, it is
14+
part of Mix public API and can be depended on.
15+
1416
## Command line options
1517
1618
* `--no-deps-check` - do not check or compile deps, only load available ones

lib/mix/lib/mix/tasks/help.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ defmodule Mix.Tasks.Help do
107107
defp loadpaths! do
108108
Mix.Task.run "loadpaths", ["--no-elixir-version-check", "--no-deps-check", "--no-archives-check"]
109109
Mix.Task.reenable "loadpaths"
110-
Mix.Task.reenable "deps.check"
110+
Mix.Task.reenable "deps.loadpaths"
111111
end
112112

113113
defp load_tasks() do

lib/mix/lib/mix/tasks/loadpaths.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule Mix.Tasks.Loadpaths do
3333
# --no-deps is used only internally. It has no purpose
3434
# from Mix.CLI because the CLI itself already loads deps.
3535
unless "--no-deps" in args do
36-
Mix.Task.run "deps.check", args
36+
Mix.Task.run "deps.loadpaths", args
3737
end
3838

3939
if config[:app] do

lib/mix/test/mix/dep_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,12 @@ defmodule Mix.DepTest do
346346
refute_received {:mix_shell, :info, ["* Getting" <> _]}
347347

348348
assert_raise Mix.Error, "Can't continue due to errors on dependencies", fn ->
349-
Mix.Tasks.Deps.Check.run([])
349+
Mix.Tasks.Deps.Loadpaths.run([])
350350
end
351351

352352
Mix.ProjectStack.clear_cache()
353353
Mix.env(:prod)
354-
Mix.Tasks.Deps.Check.run([])
354+
Mix.Tasks.Deps.Loadpaths.run([])
355355
end
356356
end
357357
end

lib/mix/test/mix/tasks/deps.git_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ defmodule Mix.Tasks.DepsGitTest do
9090
File.rm_rf!("deps/git_repo/.git")
9191

9292
assert_raise Mix.Error, "Can't continue due to errors on dependencies", fn ->
93-
Mix.Tasks.Deps.Check.run ["git_repo"]
93+
Mix.Tasks.Deps.Loadpaths.run ["git_repo"]
9494
end
9595
end
9696
end
@@ -126,7 +126,7 @@ defmodule Mix.Tasks.DepsGitTest do
126126
Code.delete_path("_build/dev/lib/git_repo/ebin")
127127

128128
# Deps on Git repo loads it automatically on compile
129-
Mix.Task.reenable "deps.check"
129+
Mix.Task.reenable "deps.loadpaths"
130130
Mix.Tasks.Deps.Compile.run ["deps_on_git_repo"]
131131
assert File.exists?("_build/dev/lib/deps_on_git_repo/ebin")
132132
end
@@ -243,7 +243,7 @@ defmodule Mix.Tasks.DepsGitTest do
243243
# Update the lock and now we should get an error
244244
Mix.Dep.Lock.write %{git_repo: {:git, fixture_path("git_repo"), last, []}}
245245
assert_raise Mix.Error, fn ->
246-
Mix.Tasks.Deps.Check.run []
246+
Mix.Tasks.Deps.Loadpaths.run []
247247
end
248248

249249
# Flush the errors we got, move to a clean slate

lib/mix/test/mix/tasks/deps_test.exs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ defmodule Mix.Tasks.DepsTest do
121121
end
122122
end
123123

124-
## deps.check
124+
## deps.loadpaths
125125

126126
test "checks list of dependencies and their status with success" do
127127
Mix.Project.push SuccessfulDepsApp
128128

129129
in_fixture "deps_status", fn ->
130-
Mix.Tasks.Deps.Check.run []
130+
Mix.Tasks.Deps.Loadpaths.run []
131131
end
132132
end
133133

@@ -136,7 +136,7 @@ defmodule Mix.Tasks.DepsTest do
136136

137137
in_fixture "deps_status", fn ->
138138
assert_raise Mix.Error, fn ->
139-
Mix.Tasks.Deps.Check.run []
139+
Mix.Tasks.Deps.Loadpaths.run []
140140
end
141141

142142
assert_received {:mix_shell, :error, ["* ok (https://github.com/elixir-lang/ok.git)"]}
@@ -160,7 +160,7 @@ defmodule Mix.Tasks.DepsTest do
160160
File.rm_rf("_build")
161161

162162
Mix.Tasks.Deps.Compile.run []
163-
Mix.Tasks.Deps.Check.run []
163+
Mix.Tasks.Deps.Loadpaths.run []
164164
assert File.exists?("_build/dev/lib/ok/ebin/ok.app")
165165
assert File.exists?("_build/dev/lib/ok/priv/sample")
166166

@@ -174,7 +174,7 @@ defmodule Mix.Tasks.DepsTest do
174174
Mix.Project.pop
175175
Mix.Project.push SuccessfulDepsApp
176176

177-
Mix.Tasks.Deps.Check.run []
177+
Mix.Tasks.Deps.Loadpaths.run []
178178
refute to_charlist(Path.expand("_build/dev/lib/ok/ebin/")) in :code.get_path
179179
assert File.exists?("_build/dev/lib/ok/ebin/ok.app")
180180
assert File.exists?("_build/dev/lib/sample/ebin/sample.app")
@@ -185,7 +185,7 @@ defmodule Mix.Tasks.DepsTest do
185185
Mix.Project.pop
186186
Mix.Project.push SuccessfulDepsApp
187187

188-
Mix.Tasks.Deps.Check.run []
188+
Mix.Tasks.Deps.Loadpaths.run []
189189
refute File.exists?("_build/dev/lib/ok/ebin/ok.app")
190190
assert File.exists?("_build/dev/lib/sample/ebin/sample.app")
191191
end
@@ -379,7 +379,7 @@ defmodule Mix.Tasks.DepsTest do
379379

380380
in_fixture "deps_status", fn ->
381381
assert_raise Mix.Error, fn ->
382-
Mix.Tasks.Deps.Check.run []
382+
Mix.Tasks.Deps.Loadpaths.run []
383383
end
384384
assert_received {:mix_shell, :error, [" the dependency git_repo in mix.exs is overriding a child dependency" <> _]}
385385

@@ -400,7 +400,7 @@ defmodule Mix.Tasks.DepsTest do
400400

401401
in_fixture "deps_status", fn ->
402402
assert_raise Mix.Error, fn ->
403-
Mix.Tasks.Deps.Check.run []
403+
Mix.Tasks.Deps.Loadpaths.run []
404404
end
405405

406406
assert_received {:mix_shell, :error, [" different specs were given for the git_repo app:" <> _ = msg]}
@@ -431,7 +431,7 @@ defmodule Mix.Tasks.DepsTest do
431431

432432
assert_raise Mix.Error, fn ->
433433
Mix.Tasks.Deps.Get.run []
434-
Mix.Tasks.Deps.Check.run []
434+
Mix.Tasks.Deps.Loadpaths.run []
435435
end
436436

437437
assert_received {:mix_shell, :error, [" the dependency git_repo 0.1.0" <> _ = msg]}
@@ -462,7 +462,7 @@ defmodule Mix.Tasks.DepsTest do
462462

463463
assert_raise Mix.Error, fn ->
464464
Mix.Tasks.Deps.Get.run []
465-
Mix.Tasks.Deps.Check.run []
465+
Mix.Tasks.Deps.Loadpaths.run []
466466
end
467467

468468
assert_received {:mix_shell, :error, [" the dependency git_repo in mix.exs is overriding" <> _]}
@@ -518,7 +518,7 @@ defmodule Mix.Tasks.DepsTest do
518518

519519
in_fixture "deps_status", fn ->
520520
assert_raise Mix.Error, fn ->
521-
Mix.Tasks.Deps.Check.run []
521+
Mix.Tasks.Deps.Loadpaths.run []
522522
end
523523

524524
receive do
@@ -538,7 +538,7 @@ defmodule Mix.Tasks.DepsTest do
538538

539539
in_fixture "deps_status", fn ->
540540
Mix.Tasks.Deps.Compile.run []
541-
Mix.Tasks.Deps.Check.run []
541+
Mix.Tasks.Deps.Loadpaths.run []
542542

543543
File.mkdir_p!("_build/dev/lib/ok/ebin")
544544
manifest_data = :erlang.term_to_binary({:v1, "the_future", :scm})
@@ -550,8 +550,8 @@ defmodule Mix.Tasks.DepsTest do
550550
Mix.Tasks.Deps.run []
551551
assert_received {:mix_shell, :info, [^msg]}
552552

553-
# deps.check will automatically recompile it
554-
Mix.Tasks.Deps.Check.run []
553+
# deps.loadpaths will automatically recompile it
554+
Mix.Tasks.Deps.Loadpaths.run []
555555

556556
Mix.Tasks.Deps.run []
557557
refute_received {:mix_shell, :info, [^msg]}
@@ -563,7 +563,7 @@ defmodule Mix.Tasks.DepsTest do
563563

564564
in_fixture "deps_status", fn ->
565565
Mix.Tasks.Deps.Compile.run []
566-
Mix.Tasks.Deps.Check.run []
566+
Mix.Tasks.Deps.Loadpaths.run []
567567

568568
File.mkdir_p!("_build/dev/lib/ok/ebin")
569569
manifest_data = :erlang.term_to_binary({:v1, System.version, :scm})
@@ -575,8 +575,8 @@ defmodule Mix.Tasks.DepsTest do
575575
Mix.Tasks.Deps.run []
576576
assert_received {:mix_shell, :info, [^msg]}
577577

578-
# deps.check will automatically recompile it
579-
Mix.Tasks.Deps.Check.run []
578+
# deps.loadpaths will automatically recompile it
579+
Mix.Tasks.Deps.Loadpaths.run []
580580

581581
Mix.Tasks.Deps.run []
582582
refute_received {:mix_shell, :info, [^msg]}

lib/mix/test/mix/umbrella_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Mix.UmbrellaTest do
1414

1515
# Ensure we can compile and run checks
1616
Mix.Task.run "deps.compile"
17-
Mix.Task.run "deps.check"
17+
Mix.Task.run "deps.loadpaths"
1818
Mix.Task.run "compile", ["--verbose"]
1919

2020
assert_received {:mix_shell, :info, ["==> bar"]}

0 commit comments

Comments
 (0)