Skip to content

Commit ab8ba93

Browse files
author
José Valim
committed
Only print req mismatch for dependencies on compile
1 parent 9d62e67 commit ab8ba93

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,12 @@ defmodule Mix.Dep.Loader do
202202

203203
defp mix_dep(%Mix.Dep{opts: opts} = dep) do
204204
Mix.Dep.in_dependency(dep, fn _ ->
205-
config = Mix.Project.config
206205
umbrella? = Mix.Project.umbrella?
207206

208207
if umbrella? do
209208
opts = Keyword.put_new(opts, :app, false)
210209
end
211210

212-
if req = old_elixir_req(config) do
213-
Mix.shell.error "warning: the dependency #{dep.app} requires Elixir #{inspect req} " <>
214-
"but you are running on v#{System.version}"
215-
end
216-
217211
dep = %{dep | manager: :mix, opts: opts, extra: [umbrella: umbrella?]}
218212
{dep, children(env: opts[:env] || :prod)}
219213
end)
@@ -287,11 +281,4 @@ defmodule Mix.Dep.Loader do
287281
{:error, _} -> {:noappfile, app_path}
288282
end
289283
end
290-
291-
defp old_elixir_req(config) do
292-
req = config[:elixir]
293-
if req && not Version.match?(System.version, req) do
294-
req
295-
end
296-
end
297284
end

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ defmodule Mix.Tasks.Deps.Compile do
9393

9494
defp do_mix(dep) do
9595
Mix.Dep.in_dependency dep, fn _ ->
96+
if req = old_elixir_req(Mix.Project.config) do
97+
Mix.shell.error "warning: the dependency #{dep.app} requires Elixir #{inspect req} " <>
98+
"but you are running on v#{System.version}"
99+
end
100+
96101
try do
97102
res = Mix.Task.run("compile", ["--no-deps", "--no-elixir-version-check", "--no-readd"])
98103
:ok in List.wrap(res)
@@ -172,4 +177,11 @@ defmodule Mix.Tasks.Deps.Compile do
172177
Mix.Project.build_structure(config, symlink_ebin: true)
173178
end
174179
end
180+
181+
defp old_elixir_req(config) do
182+
req = config[:elixir]
183+
if req && not Version.match?(System.version, req) do
184+
req
185+
end
186+
end
175187
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ defmodule Mix.Tasks.DepsTest do
8484
end
8585
"""
8686

87-
Mix.Tasks.Deps.run []
87+
Mix.Tasks.Deps.Compile.run [:ok]
8888

8989
msg = "warning: the dependency ok requires Elixir \"~> 0.1.0\" " <>
9090
"but you are running on v#{System.version}"

0 commit comments

Comments
 (0)