@@ -26,7 +26,8 @@ defmodule Mix.Compilers.Elixir do
26
26
# changed, let's just compile everything
27
27
all
28
28
else
29
- modified = Mix.Utils . last_modified ( manifest )
29
+ modified = Mix.Utils . last_modified ( manifest )
30
+ all_mtimes = mtimes ( all_entries )
30
31
31
32
# Otherwise let's start with the new ones
32
33
# plus the ones that have changed
@@ -35,7 +36,8 @@ defmodule Mix.Compilers.Elixir do
35
36
do: source )
36
37
++
37
38
for ( { _b , _m , source , _d , files } <- all_entries ,
38
- Mix.Utils . stale? ( [ source | files ] , [ modified ] ) ,
39
+ times = Enum . map ( [ source | files ] , & HashDict . fetch! ( all_mtimes , & 1 ) ) ,
40
+ Mix.Utils . stale? ( times , [ modified ] ) ,
39
41
do: source )
40
42
end
41
43
@@ -53,6 +55,18 @@ defmodule Mix.Compilers.Elixir do
53
55
end
54
56
end
55
57
58
+ defp mtimes ( entries ) do
59
+ Enum . reduce ( entries , HashDict . new , fn { _b , _m , source , _d , files } , dict ->
60
+ Enum . reduce ( [ source | files ] , dict , fn file , dict ->
61
+ if HashDict . has_key? ( dict , file ) do
62
+ dict
63
+ else
64
+ HashDict . put ( dict , file , Mix.Utils . last_modified ( file ) )
65
+ end
66
+ end )
67
+ end )
68
+ end
69
+
56
70
@ doc """
57
71
Removes compiled files.
58
72
"""
0 commit comments