Skip to content

Commit

Permalink
Emit a warning if path dependency does not exist, closes #13915
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Nov 18, 2024
1 parent 8e1d041 commit 4162d23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions lib/mix/lib/mix/dep/fetcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ defmodule Mix.Dep.Fetcher do
cond do
# Dependencies that cannot be fetched are always compiled afterwards
not scm.fetchable?() ->
if not scm.checked_out?(opts) do
Mix.shell().error("warning: missing dependency #{format_dep(dep)}")
end

{dep, [app | acc], lock}

# If the dependency is not available or we have a lock mismatch
Expand Down
14 changes: 6 additions & 8 deletions lib/mix/test/mix/dep_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ defmodule Mix.DepTest do

Mix.Tasks.Deps.run([])
assert_received {:mix_shell, :info, ["* deps_repo1" <> _]}
assert_received {:mix_shell, :info, [_]}
assert_received {:mix_shell, :info, ["* deps_repo2" <> _]}
assert_received {:mix_shell, :info, [_]}
assert_received {:mix_shell, :info, ["* git_repo" <> _]}
assert_received {:mix_shell, :info, [msg]}
assert msg =~ "different specs were given for the git_repo"

assert_received {:mix_shell, :info,
[" different specs were given for the git_repo app" <> _]}
end)
end)
end
Expand Down Expand Up @@ -343,12 +342,11 @@ defmodule Mix.DepTest do

Mix.Tasks.Deps.run([])
assert_received {:mix_shell, :info, ["* deps_repo1" <> _]}
assert_received {:mix_shell, :info, [_]}
assert_received {:mix_shell, :info, ["* deps_repo2" <> _]}
assert_received {:mix_shell, :info, [_]}
assert_received {:mix_shell, :info, ["* git_repo" <> _]}
assert_received {:mix_shell, :info, [msg]}
assert msg =~ "different specs were given for the git_repo"

assert_received {:mix_shell, :info,
[" different specs were given for the git_repo app" <> _]}
end)
end)
end
Expand Down

0 comments on commit 4162d23

Please sign in to comment.