@@ -159,7 +159,7 @@ defmodule Mix.Dep.Converger do
159
159
160
160
defp init_all ( main , apps , rest , lock , callback , locked? , env_target , cache ) do
161
161
state = % { locked?: locked? , env_target: env_target , cache: cache , callback: callback }
162
- { deps , _optional , rest , lock } = all ( main , [ ] , [ ] , apps , [ ] , rest , lock , state )
162
+ { deps , _kept , _optional , rest , lock } = all ( main , [ ] , [ ] , [ ] , apps , [ ] , rest , lock , state )
163
163
deps = Enum . reverse ( deps )
164
164
# When traversing dependencies, we keep skipped ones to
165
165
# find conflicts. We remove them now after traversal.
@@ -206,18 +206,19 @@ defmodule Mix.Dep.Converger do
206
206
# Now, since "d" was specified in a parent project, no
207
207
# exception is going to be raised since d is considered
208
208
# to be the authoritative source.
209
- defp all ( [ dep | t ] , acc , upper , breadths , optional , rest , lock , state ) do
209
+ defp all ( [ dep | t ] , acc , kept , upper , breadths , optional , rest , lock , state ) do
210
210
case match_deps ( acc , upper , dep , state . env_target ) do
211
211
{ :replace , dep , acc } ->
212
- all ( [ dep | t ] , acc , upper , breadths , optional , rest , lock , state )
212
+ all ( [ dep | t ] , acc , kept , upper , breadths , optional , rest , lock , state )
213
213
214
214
{ :match , acc } ->
215
- all ( t , acc , upper , breadths , optional , rest , lock , state )
215
+ all ( t , acc , kept , upper , breadths , optional , rest , lock , state )
216
216
217
217
:skip ->
218
218
# We still keep skipped dependencies around to detect conflicts.
219
- # They must be rejected after every all iteration.
220
- all ( t , [ dep | acc ] , upper , breadths , optional , rest , lock , state )
219
+ # They must be rejected after every all iteration but they are not
220
+ # included in the list of kept dependencies.
221
+ all ( t , [ dep | acc ] , kept , upper , breadths , optional , rest , lock , state )
221
222
222
223
:nomatch ->
223
224
{ % { app: app , deps: deps , opts: opts } = dep , rest , lock } =
@@ -239,21 +240,21 @@ defmodule Mix.Dep.Converger do
239
240
# Something that we previously ruled out as an optional dependency is
240
241
# no longer a dependency. Add it back for traversal.
241
242
{ no_longer_optional , optional } = Enum . split_with ( optional , & ( & 1 . app == app ) )
243
+ t = no_longer_optional ++ t
242
244
243
- { acc , optional , rest , lock } =
244
- all ( no_longer_optional ++ t , [ dep | acc ] , upper , breadths , optional , rest , lock , state )
245
+ { acc , kept , optional , rest , lock } =
246
+ all ( t , [ dep | acc ] , [ dep . app | kept ] , upper , breadths , optional , rest , lock , state )
245
247
246
248
# Now traverse all parent dependencies and see if we have any optional dependency.
247
- { discarded , deps } =
248
- split_non_fulfilled_optional ( deps , Enum . map ( acc , & & 1 . app ) , opts [ :from_umbrella ] )
249
+ { discarded , deps } = split_non_fulfilled_optional ( deps , kept , opts [ :from_umbrella ] )
249
250
250
251
new_breadths = Enum . map ( deps , & & 1 . app ) ++ breadths
251
- all ( deps , acc , breadths , new_breadths , discarded ++ optional , rest , lock , state )
252
+ all ( deps , acc , kept , breadths , new_breadths , discarded ++ optional , rest , lock , state )
252
253
end
253
254
end
254
255
255
- defp all ( [ ] , acc , _upper , _current , optional , rest , lock , _state ) do
256
- { acc , optional , rest , lock }
256
+ defp all ( [ ] , acc , kept , _upper , _current , optional , rest , lock , _state ) do
257
+ { acc , kept , optional , rest , lock }
257
258
end
258
259
259
260
defp put_lock ( % Mix.Dep { app: app } = dep , lock ) do
0 commit comments