Skip to content

Commit 9a1abb4

Browse files
committed
Touch the compile path when writing .app file for the first time
Closes #14049.
1 parent 77ea87a commit 9a1abb4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ defmodule Mix.Tasks.Compile.App do
189189
Mix.Project.ensure_structure()
190190
File.write!(target, IO.chardata_to_string(contents))
191191
File.touch!(target, new_mtime)
192+
193+
# If we just created the .app file, it will have touched
194+
# the directory mtime, so we need to reset it.
195+
if current_properties == [] do
196+
File.touch!(compile_path, new_mtime)
197+
end
198+
192199
Mix.shell().info("Generated #{app} app")
193200
{:ok, []}
194201
else

lib/mix/test/mix/tasks/compile.app_test.exs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ defmodule Mix.Tasks.Compile.AppTest do
6666
test "generates .app file when changes happen" do
6767
in_fixture("no_mixfile", fn ->
6868
Mix.Project.push(MixTest.Case.Sample)
69-
# Pre-create the compilation path to avoid mtime races
70-
File.mkdir_p(Mix.Project.compile_path())
7169

7270
Mix.Tasks.Compile.Elixir.run([])
7371
assert Mix.Tasks.Compile.App.run([]) == {:ok, []}
@@ -256,8 +254,6 @@ defmodule Mix.Tasks.Compile.AppTest do
256254
test ".app contains description and registered (as required by systools)" do
257255
in_fixture("no_mixfile", fn ->
258256
Mix.Project.push(MixTest.Case.Sample)
259-
# Pre-create the compilation path to avoid mtime races
260-
File.mkdir_p(Mix.Project.compile_path())
261257

262258
Mix.Tasks.Compile.Elixir.run([])
263259
assert Mix.Tasks.Compile.App.run([]) == {:ok, []}

0 commit comments

Comments
 (0)