From 2b15408a66d35b5c15f1720c87ad42fdb7c2db42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 4 May 2025 11:28:17 +0200 Subject: [PATCH] Ensure compile.lock timestamp is bumped, closes #14464 --- lib/mix/test/mix/tasks/compile.elixir_test.exs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/lib/mix/test/mix/tasks/compile.elixir_test.exs +++ b/lib/mix/test/mix/tasks/compile.elixir_test.exs @@ -468,6 +468,8 @@ defmodule A do recompile = fn -> Mix.ProjectStack.pop() Mix.Project.push(MixTest.Case.Sample) + File.touch!("_build/dev/lib/sample/.mix/compile.elixir", @old_time) + ensure_touched("mix.lock") Mix.Tasks.WillRecompile.run([]) Mix.Tasks.Compile.Elixir.run(["--verbose"]) end @@ -477,8 +479,6 @@ defmodule A do %{"logger": :unused} """) - ensure_touched("mix.lock") - File.touch!("_build/dev/lib/sample/.mix/compile.elixir", @old_time) assert recompile.() == {:ok, []} assert_received {:mix_shell, :info, ["Compiled lib/a.ex"]} refute_received {:mix_shell, :info, ["Compiled lib/b.ex"]} @@ -489,8 +489,6 @@ defmodule A do %{"logger": :another} """) - ensure_touched("mix.lock") - File.touch!("_build/dev/lib/sample/.mix/compile.elixir", @old_time) assert recompile.() == {:ok, []} assert_received {:mix_shell, :info, ["Compiled lib/a.ex"]} refute_received {:mix_shell, :info, ["Compiled lib/b.ex"]} @@ -501,8 +499,6 @@ defmodule A do %{} """) - ensure_touched("mix.lock") - File.touch!("_build/dev/lib/sample/.mix/compile.elixir", @old_time) assert recompile.() == {:ok, []} assert_received {:mix_shell, :info, ["Compiled lib/a.ex"]} refute_received {:mix_shell, :info, ["Compiled lib/b.ex"]} @@ -513,8 +509,6 @@ defmodule A do %{"unknown": :unknown} """) - # We use ensure_touched because an outdated manifest would recompile anyway. - ensure_touched("mix.lock", "_build/dev/lib/sample/.mix/compile.elixir") assert recompile.() == {:ok, []} refute_received {:mix_shell, :info, ["Compiled lib/a.ex"]} refute_received {:mix_shell, :info, ["Compiled lib/b.ex"]}