@@ -188,28 +188,40 @@ defmodule Mix.Dep.Loader do
188
188
189
189
## Fetching
190
190
191
- defp mix_dep ( % Mix.Dep { opts: opts } = dep , children ) do
191
+ defp mix_dep ( % Mix.Dep { opts: opts } = dep , nil ) do
192
192
Mix.Dep . in_dependency ( dep , fn _ ->
193
193
umbrella? = Mix.Project . umbrella?
194
194
195
195
if umbrella? do
196
196
opts = Keyword . put_new ( opts , :app , false )
197
197
end
198
198
199
- children = ( mix_children ( env: opts [ :env ] || :prod ) |> filter_children ( children ) )
200
- ++ Mix.Dep.Umbrella . unloaded
201
-
202
- dep = % { dep | manager: :mix , opts: opts , extra: [ umbrella: umbrella? ] }
203
- { dep , children }
199
+ deps = mix_children ( env: opts [ :env ] || :prod ) ++ Mix.Dep.Umbrella . unloaded
200
+ { % { dep | manager: :mix , opts: opts , extra: [ umbrella: umbrella? ] } , deps }
204
201
end )
205
202
end
206
203
204
+ # If we have a Mix dependency that came from a remote converger,
205
+ # we just use the dependencies given by the remote converger, we
206
+ # don't need to load the mixfile at all. We can only do this for
207
+ # now because umbrella projects are not supported.
208
+ defp mix_dep ( % Mix.Dep { opts: opts } = dep , children ) do
209
+ from = Path . join ( opts [ :dest ] , "mix.exs" )
210
+ deps = Enum . map ( children , & to_dep ( { & 1 , [ ] } , from ) )
211
+ { % { dep | manager: :mix , extra: [ umbrella: false ] } , deps }
212
+ end
213
+
207
214
defp rebar_dep ( % Mix.Dep { } = dep , children ) do
208
215
Mix.Dep . in_dependency ( dep , fn _ ->
209
216
rebar = Mix.Rebar . load_config ( "." )
210
217
extra = Dict . take ( rebar , [ :sub_dirs ] )
211
- dep = % { dep | manager: :rebar , extra: extra }
212
- { dep , rebar |> rebar_children |> filter_children ( children ) }
218
+ deps = if children do
219
+ from = Path . absname ( "rebar.config" )
220
+ Enum . map ( children , & to_dep ( { & 1 , [ ] } , from , :rebar ) )
221
+ else
222
+ rebar_children ( rebar )
223
+ end
224
+ { % { dep | manager: :rebar , extra: extra } , deps }
213
225
end )
214
226
end
215
227
@@ -239,9 +251,6 @@ defmodule Mix.Dep.Loader do
239
251
end ) |> Enum . concat
240
252
end
241
253
242
- defp filter_children ( deps , nil ) , do: deps
243
- defp filter_children ( deps , children ) , do: Enum . filter ( deps , & ( & 1 . app in children ) )
244
-
245
254
defp validate_path ( % Mix.Dep { scm: scm , manager: manager } = dep ) do
246
255
if scm == Mix.SCM.Path and not manager in [ :mix , nil ] do
247
256
Mix . raise ":path option can only be used with mix projects, " <>
0 commit comments