@@ -65,17 +65,7 @@ defmodule Mix.Dep.Fetcher do
65
65
end
66
66
67
67
if new do
68
- # There is a race condition where if you compile deps
69
- # and then immediately update them, we would not detect
70
- # a mismatch with .mix/compile.fetch, so we go ahead and
71
- # delete all of them.
72
- Mix.Project . build_path ( )
73
- |> Path . dirname ( )
74
- |> Path . join ( "*/lib/#{ dep . app } /.mix/compile.fetch" )
75
- |> Path . wildcard ( match_dot: true )
76
- |> Enum . each ( & File . rm / 1 )
77
-
78
- File . touch! ( Path . join ( opts [ :dest ] , ".fetch" ) )
68
+ mark_as_fetched ( [ dep ] )
79
69
dep = put_in ( dep . opts [ :lock ] , new )
80
70
{ dep , [ app | acc ] , Map . put ( lock , app , new ) }
81
71
else
@@ -123,14 +113,16 @@ defmodule Mix.Dep.Fetcher do
123
113
end
124
114
125
115
defp mark_as_fetched ( deps ) do
126
- # If the dependency is fetchable, we are going to write a .fetch
127
- # file to it. Each build, regardless of the environment and location,
128
- # will compared against this .fetch file to know if the dependency
129
- # needs recompiling.
130
- _ =
131
- for % Mix.Dep { scm: scm , opts: opts } <- deps , scm . fetchable? ( ) do
132
- File . touch! ( Path . join ( opts [ :dest ] , ".fetch" ) )
133
- end
116
+ build_path =
117
+ Mix.Project . build_path ( )
118
+ |> Path . dirname ( )
119
+
120
+ for % Mix.Dep { app: app , scm: scm } <- deps , scm . fetchable? ( ) do
121
+ build_path
122
+ |> Path . join ( "*/lib/#{ app } /.mix/compile.fetch" )
123
+ |> Path . wildcard ( match_dot: true )
124
+ |> Enum . each ( & File . rm / 1 )
125
+ end
134
126
135
127
:ok
136
128
end
0 commit comments