Skip to content

Commit b9cb17e

Browse files
author
José Valim
committed
deps.loadpaths no longer loads the dependencies, it relies simply on builds
1 parent 5d48abb commit b9cb17e

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

lib/mix/lib/mix/cli.ex

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ defmodule Mix.CLI do
4949

5050
defp run_task(name, args) do
5151
try do
52-
# We need to skip loading the paths for the project and
53-
# its dependencies on deps.get and deps.update to avoid
54-
# having two versions of the same dep after get or update
55-
# is done.
56-
if not deps_task?(name) && Mix.Project.get do
52+
if Mix.Project.get do
5753
Mix.Task.run "loadpaths", ["--no-deps-check", "--no-elixir-version-check"]
5854
Mix.Task.reenable "loadpaths"
5955
Mix.Task.reenable "deps.loadpaths"
@@ -91,10 +87,6 @@ defmodule Mix.CLI do
9187
IO.puts "Elixir #{System.version}"
9288
end
9389

94-
defp deps_task?("deps.update"), do: true
95-
defp deps_task?("deps.get"), do: true
96-
defp deps_task?(_), do: false
97-
9890
# Check for --help or --version in the args
9991
defp check_for_shortcuts([first_arg|_]) when first_arg in
10092
["--help", "-h", "-help"], do: :help

lib/mix/lib/mix/deps.ex

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,6 @@ defmodule Mix.Deps do
422422
Mix.Deps.Lock.write(lock)
423423
424424
unless opts[:no_compile] do
425-
# TODO: This is a temporary workaround to the fact
426-
# we do not loadpaths for deps.get and deps.update tasks
427-
# in the CLI.
428-
Mix.Task.run("deps.loadpaths", ["--no-deps-check"])
429-
Mix.Task.reenable("deps.loadpaths")
430-
431425
if apps != [] do
432426
args = if opts[:quiet], do: ["--quiet"|apps], else: apps
433427
Mix.Task.run("deps.compile", args)
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
defmodule Mix.Tasks.Deps.Loadpaths do
22
use Mix.Task
33

4-
import Mix.Deps, only: [loaded: 0, available?: 1, load_paths: 1]
5-
64
@hidden true
7-
@shortdoc "Load all dependencies' paths"
5+
@shortdoc "Load all dependencies build paths"
86

97
@moduledoc """
10-
Loads all dependencies. This is invoked directly
11-
by `loadpaths` when the CLI boots.
8+
Loads all dependencies for the current build.
9+
This is invoked directly by `loadpaths` when
10+
the CLI boots.
1211
1312
## Command line options
1413
@@ -21,8 +20,12 @@ defmodule Mix.Tasks.Deps.Loadpaths do
2120
Mix.Task.run "deps.check"
2221
end
2322

24-
lc dep inlist loaded, available?(dep) do
25-
Enum.each(load_paths(dep), &Code.prepend_path/1)
26-
end
23+
config = Mix.project
24+
25+
Mix.Project.build_path(config)
26+
|> Path.join("lib/*/ebin")
27+
|> Path.wildcard
28+
|> List.delete(not Mix.Project.umbrella? && Mix.Project.compile_path(config))
29+
|> Enum.each(&Code.prepend_path/1)
2730
end
2831
end

0 commit comments

Comments
 (0)