Skip to content

Commit 888ac77

Browse files
author
José Valim
committed
Call preserving_mtime just once, at the root compile task
1 parent f2d4d1e commit 888ac77

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

lib/mix/lib/mix/tasks/compile.elixir.ex

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ defmodule Mix.Tasks.Compile.Elixir do
5353
5454
[watch_exts: [:ex, :eex]]
5555
56-
5756
"""
5857
def run(args) do
5958
{ opts, _ } = OptionParser.parse(args, aliases: [q: :quick],
@@ -70,11 +69,8 @@ defmodule Mix.Tasks.Compile.Elixir do
7069
stale = Mix.Utils.extract_stale(to_watch, [compile_path])
7170

7271
if opts[:force] or stale != [] do
73-
Mix.Utils.preserving_mtime(compile_path, fn ->
74-
File.mkdir_p! compile_path
75-
compile_files opts[:quick], project, compile_path, to_compile, stale
76-
end)
77-
72+
File.mkdir_p! compile_path
73+
compile_files opts[:quick], project, compile_path, to_compile, stale
7874
:ok
7975
else
8076
:noop

lib/mix/lib/mix/tasks/compile.erlang.ex

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ defmodule Mix.Tasks.Compile.Erlang do
2828
if files == [] do
2929
:noop
3030
else
31-
Mix.Utils.preserving_mtime(compile_path, fn ->
32-
File.mkdir_p! compile_path
33-
compile_files project, files, compile_path
34-
end)
35-
31+
File.mkdir_p! compile_path
32+
compile_files project, files, compile_path
3633
:ok
3734
end
3835
end

lib/mix/lib/mix/tasks/compile.ex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,22 @@ defmodule Mix.Tasks.Compile do
6262

6363
def run(args) do
6464
Mix.Task.run "loadpaths", args
65+
compile_path = Mix.project[:compile_path]
6566

66-
changed = Enum.reduce get_compilers, false, fn(compiler, acc) ->
67-
res = Mix.Task.run "compile.#{compiler}", args
68-
acc or res != :noop
69-
end
67+
changed =
68+
Mix.Utils.preserving_mtime(compile_path, fn ->
69+
Enum.reduce get_compilers, false, fn(compiler, acc) ->
70+
res = Mix.Task.run "compile.#{compiler}", args
71+
acc or res != :noop
72+
end
73+
end)
7074

7175
# If any of the tasks above returns something different
7276
# than :noop, it means they produced something, so we
7377
# touch the common target `compile_path`. Notice that
7478
# we choose :noop since it is also the value returned
7579
# by a task that we already invoked.
76-
if changed, do: File.touch Mix.project[:compile_path]
80+
if changed, do: File.touch compile_path
7781
end
7882

7983
defp get_compilers do

lib/mix/lib/mix/tasks/run.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ defmodule Mix.Tasks.Run do
1414
* `--require`, `-r` - Requires a file before running the command
1515
* `--parallel-require`, `-pr` - Requires a file in parallel
1616
* `--no-halt` - Does not halt the system after running the command
17-
* `--no-compile` - do not compile even if files require compilation;
18-
* `--no-start` - do not start applications after compilation;
17+
* `--no-compile` - Do not compile even if files require compilation;
18+
* `--no-start` - Do not start applications after compilation;
1919
2020
## Examples
2121

0 commit comments

Comments
 (0)