@@ -11,7 +11,8 @@ defmodule Mix.Deps.Retriever do
1111 def children ( ) do
1212 # Don't run recursively for the top-level project
1313 scms = Mix.SCM . available
14- ( Mix . project [ :deps ] || [ ] ) |> Enum . map ( update ( & 1 , scms , nil ) )
14+ from = current_source ( :mix )
15+ ( Mix . project [ :deps ] || [ ] ) |> Enum . map ( update ( & 1 , scms , nil , from ) )
1516 end
1617
1718 @ doc """
@@ -37,31 +38,34 @@ defmodule Mix.Deps.Retriever do
3738 @ doc """
3839 Receives a dependency and update its status.
3940 """
40- def update ( Mix.Dep [ scm : scm , app: app , requirement: req , opts: opts ] ) do
41- update ( { app , req , opts } , [ scm ] , nil )
41+ def update ( Mix.Dep [ scm : scm , app: app , requirement: req , opts: opts ,
42+ manager: manager , from: from ] ) do
43+ update ( { app , req , opts } , [ scm ] , manager , from )
4244 end
4345
4446 ## Helpers
4547
4648 defp mix_children ( config ) do
4749 scms = Mix.SCM . available
4850 Mix.Project . recur ( config , fn _ ->
49- ( Mix . project [ :deps ] || [ ] ) |> Enum . map ( update ( & 1 , scms , :mix ) )
51+ from = current_source ( :mix )
52+ ( Mix . project [ :deps ] || [ ] ) |> Enum . map ( update ( & 1 , scms , nil , from ) )
5053 end ) |> List . concat
5154 end
5255
5356 defp rebar_children ( dir ) do
5457 scms = Mix.SCM . available
5558 Mix.Rebar . recur ( dir , fn config ->
56- Mix.Rebar . deps ( config ) |> Enum . map ( update ( & 1 , scms , :rebar ) )
59+ from = current_source ( :rebar )
60+ Mix.Rebar . deps ( config ) |> Enum . map ( update ( & 1 , scms , :rebar , from ) )
5761 end ) |> List . concat
5862 end
5963
60- defp update ( tuple , scms , manager ) do
61- dep = with_scm_and_status ( tuple , scms )
62- |> update_from ( manager )
64+ defp update ( tuple , scms , manager , from ) do
65+ dep = with_scm_and_status ( tuple , scms ) . from ( from )
6366
64- if match? ( { _ , req , _ } when is_regex ( req ) , tuple ) and manager != :rebar do
67+ if match? ( { _ , req , _ } when is_regex ( req ) , tuple ) and
68+ not String . ends_with? ( from , "rebar.config" ) do
6569 Mix . shell . info ( "[WARNING] Regex version requirement for dependencies is " <>
6670 "deprecated, please use Mix.Version instead" )
6771 end
@@ -87,14 +91,11 @@ defmodule Mix.Deps.Retriever do
8791 end
8892 end
8993
90- defp update_from ( dep , manager ) do
91- filename = case manager do
94+ defp current_source ( manager ) do
95+ case manager do
9296 :mix -> "mix.exs"
9397 :rebar -> "rebar.config"
94- nil -> nil
95- end
96- path = if filename , do: Path . absname ( filename ) , else: File . cwd!
97- dep . from ( path )
98+ end |> Path . absname
9899 end
99100
100101 defp mix_dep ( Mix.Dep [ manager : nil ] = dep , project ) do
0 commit comments