@@ -7,11 +7,22 @@ defmodule Mix.Compilers.ApplicationTracer do
77 def init ( { stale_deps , opts } ) do
88 config = Mix.Project . config ( )
99 manifest = manifest ( config )
10+ modified = Mix.Utils . last_modified ( manifest )
1011
11- if Mix.Utils . stale? ( [ Mix.Project . config_mtime ( ) ] , [ manifest ] ) do
12- build_manifest ( config , manifest )
13- else
14- read_manifest ( manifest , stale_deps ) || build_manifest ( config , manifest )
12+ cond do
13+ Mix.Utils . stale? ( [ Mix.Project . config_mtime ( ) ] , [ modified ] ) ->
14+ build_manifest ( config , manifest )
15+
16+ table = read_manifest ( manifest , stale_deps ) ->
17+ for % { app: app , scm: scm , opts: opts } <- Mix.Dep . cached ( ) ,
18+ not scm . fetchable? ,
19+ Mix.Utils . last_modified ( Path . join ( [ opts [ :build ] , "ebin" , "#{ app } .app" ] ) ) > modified do
20+ delete_app ( table , app )
21+ store_app ( table , app )
22+ end
23+
24+ true ->
25+ build_manifest ( config , manifest )
1526 end
1627
1728 setup_warnings_table ( config )
@@ -204,9 +215,7 @@ defmodule Mix.Compilers.ApplicationTracer do
204215 Map . has_key? ( seen , app ) ->
205216 seen
206217
207- modules = Application . spec ( app , :modules ) ->
208- :ets . insert ( table , Enum . map ( modules , & { & 1 } ) )
209-
218+ store_app ( table , app ) ->
210219 seen
211220 |> Map . put ( app , true )
212221 |> store_apps ( table , Application . spec ( app , :applications ) )
@@ -216,4 +225,17 @@ defmodule Mix.Compilers.ApplicationTracer do
216225 seen
217226 end
218227 end
228+
229+ defp delete_app ( table , app ) do
230+ :ets . match_delete ( table , { :"$_" , app } )
231+ end
232+
233+ defp store_app ( table , app ) do
234+ if modules = Application . spec ( app , :modules ) do
235+ :ets . insert ( table , Enum . map ( modules , & { & 1 , app } ) )
236+ true
237+ else
238+ false
239+ end
240+ end
219241end
0 commit comments