@@ -26,7 +26,8 @@ defmodule Mix.Compilers.Elixir do
2626 # changed, let's just compile everything
2727 all
2828 else
29- modified = Mix.Utils . last_modified ( manifest )
29+ modified = Mix.Utils . last_modified ( manifest )
30+ all_mtimes = mtimes ( all_entries )
3031
3132 # Otherwise let's start with the new ones
3233 # plus the ones that have changed
@@ -35,7 +36,8 @@ defmodule Mix.Compilers.Elixir do
3536 do: source )
3637 ++
3738 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 ] ) ,
3941 do: source )
4042 end
4143
@@ -53,6 +55,18 @@ defmodule Mix.Compilers.Elixir do
5355 end
5456 end
5557
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+
5670 @ doc """
5771 Removes compiled files.
5872 """
0 commit comments