Skip to content

Commit a503069

Browse files
author
José Valim
committed
Ensure we consolidate only when there was a change
1 parent 120ea0f commit a503069

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ defmodule Mix.Tasks.Compile do
6060
def run(args) do
6161
Mix.Project.get!
6262
Mix.Task.run "loadpaths", args
63+
6364
res = Mix.Task.run "compile.all", args
65+
res = if :ok in List.wrap(res), do: :ok, else: :noop
6466

65-
if consolidate_protocols?() do
67+
if res == :ok && consolidate_protocols?() do
6668
Mix.Task.run "compile.protocols", args
6769
end
6870

lib/mix/test/mix/tasks/compile_test.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ defmodule Mix.Tasks.CompileTest do
5252
assert_received {:mix_shell, :info, ["Consolidated Enumerable"]}
5353
assert File.regular? "_build/dev/consolidated/Elixir.Enumerable.beam"
5454

55+
assert Mix.Tasks.Compile.run([]) == :noop
56+
refute_received {:mix_shell, :info, ["Consolidated Enumerable"]}
57+
5558
assert Mix.Tasks.App.Start.run([]) == :ok
5659
assert Protocol.consolidated?(Enumerable)
5760
end

0 commit comments

Comments
 (0)