Skip to content

Commit 52ec313

Browse files
josevalimNezteb
authored andcommitted
Also version rebar dependencies according to otp-elixir-scm, closes #14548
1 parent cc6a777 commit 52ec313

File tree

8 files changed

+18
-21
lines changed

8 files changed

+18
-21
lines changed

lib/mix/lib/mix/compilers/elixir.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ defmodule Mix.Compilers.Elixir do
922922
# Since Elixir is a dependency itself, we need to touch the lock
923923
# so the current Elixir version, used to compile the files above,
924924
# is properly stored.
925-
Mix.Dep.ElixirSCM.update()
925+
Mix.Dep.ElixirSCM.update(Mix.Project.config()[:build_scm])
926926
:ok
927927
end
928928

lib/mix/lib/mix/dep.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ defmodule Mix.Dep do
384384
end
385385
end
386386

387-
def format_status(%Mix.Dep{status: {:elixirlock, _}}) do
388-
"the dependency was built with an out-of-date Elixir version, run \"#{mix_env_var()}mix deps.compile\""
387+
def format_status(%Mix.Dep{status: {:vsnlock, _}}) do
388+
"the dependency was built with an out-of-date Erlang/Elixir version, run \"#{mix_env_var()}mix deps.compile\""
389389
end
390390

391391
def format_status(%Mix.Dep{status: {:scmlock, _}}) do
@@ -448,7 +448,7 @@ defmodule Mix.Dep do
448448

449449
case Mix.Dep.ElixirSCM.read(Path.join(build_path, ".mix")) do
450450
{:ok, old_vsn, _} when old_vsn != vsn ->
451-
%{dep | status: {:elixirlock, old_vsn}}
451+
%{dep | status: {:vsnlock, old_vsn}}
452452

453453
{:ok, _, old_scm} when old_scm != scm ->
454454
%{dep | status: {:scmlock, old_scm}}
@@ -485,7 +485,7 @@ defmodule Mix.Dep do
485485
@doc """
486486
Returns `true` if the dependency is compilable.
487487
"""
488-
def compilable?(%Mix.Dep{status: {:elixirlock, _}}), do: true
488+
def compilable?(%Mix.Dep{status: {:vsnlock, _}}), do: true
489489
def compilable?(%Mix.Dep{status: {:noappfile, {_, _}}}), do: true
490490
def compilable?(%Mix.Dep{status: {:scmlock, _}}), do: true
491491
def compilable?(%Mix.Dep{status: :compile}), do: true

lib/mix/lib/mix/dep/elixir_scm.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-FileCopyrightText: 2021 The Elixir Team
33
# SPDX-FileCopyrightText: 2012 Plataformatec
44

5-
# Manifest file where we treat Elixir and SCMs as a dependency.
5+
# Manifest file where we treat Erlang/OTP, Elixir and SCMs as a dependency.
66
defmodule Mix.Dep.ElixirSCM do
77
@moduledoc false
88
@manifest "compile.elixir_scm"
@@ -12,12 +12,11 @@ defmodule Mix.Dep.ElixirSCM do
1212
Path.join(manifest_path, @manifest)
1313
end
1414

15-
def update(manifest_path \\ Mix.Project.manifest_path()) do
16-
config = Mix.Project.config()
15+
def update(manifest_path \\ Mix.Project.manifest_path(), scm) do
1716
File.mkdir_p!(manifest_path)
1817

1918
manifest_data =
20-
{@manifest_vsn, {System.version(), :erlang.system_info(:otp_release)}, config[:build_scm]}
19+
{@manifest_vsn, {System.version(), :erlang.system_info(:otp_release)}, scm}
2120
|> :erlang.term_to_binary()
2221

2322
File.write!(manifest(manifest_path), manifest_data)

lib/mix/lib/mix/dep/fetcher.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ defmodule Mix.Dep.Fetcher do
127127

128128
for %Mix.Dep{app: app, scm: scm} <- deps, scm.fetchable?() do
129129
build_path
130-
|> Path.join("*/lib/#{app}/.mix/compile.fetch")
130+
|> Path.join("*/lib/#{app}/.mix/compile.elixir_scm")
131131
|> Path.wildcard(match_dot: true)
132132
|> Enum.each(&File.rm/1)
133133
end

lib/mix/lib/mix/dep/loader.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ defmodule Mix.Dep.Loader do
407407
end
408408

409409
defp recently_fetched?(%Mix.Dep{opts: opts, scm: scm}) do
410-
scm.fetchable?() and not File.exists?(Path.join(opts[:build], ".mix/compile.fetch"))
410+
scm.fetchable?() and not File.exists?(Path.join(opts[:build], ".mix/compile.elixir_scm"))
411411
end
412412

413413
defp app_status(app_path, app, req) do

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ defmodule Mix.Tasks.Deps.Compile do
191191

192192
defp touch_fetchable(scm, path) do
193193
if scm.fetchable?() do
194-
path = Path.join(path, ".mix")
195-
File.mkdir_p!(path)
196-
File.touch!(Path.join(path, "compile.fetch"))
194+
Mix.Dep.ElixirSCM.update(Path.join(path, ".mix"), scm)
197195
true
198196
else
199197
false

lib/mix/test/mix/tasks/deps.git_test.exs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ defmodule Mix.Tasks.DepsGitTest do
170170

171171
# Compile the dependencies
172172
Mix.Tasks.Deps.Compile.run([])
173-
assert File.exists?("_build/dev/lib/deps_on_git_repo/.mix/compile.fetch")
174-
assert File.exists?("_build/dev/lib/git_repo/.mix/compile.fetch")
173+
assert File.exists?("_build/dev/lib/deps_on_git_repo/.mix/compile.elixir_scm")
174+
assert File.exists?("_build/dev/lib/git_repo/.mix/compile.elixir_scm")
175175

176176
# Now update children and make sure it propagates
177177
Mix.Tasks.Deps.Update.run(["git_repo"])
178-
refute File.exists?("_build/dev/lib/deps_on_git_repo/.mix/compile.fetch")
179-
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.fetch")
178+
refute File.exists?("_build/dev/lib/deps_on_git_repo/.mix/compile.elixir_scm")
179+
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.elixir_scm")
180180

181181
# Clear tasks to recompile Git repo but unload it so...
182182
purge([GitRepo])
@@ -408,7 +408,7 @@ defmodule Mix.Tasks.DepsGitTest do
408408
assert File.exists?("deps/git_repo/lib/git_repo.ex")
409409
assert File.read!("mix.lock") =~ last
410410
assert File.read!("deps/deps_on_git_repo/lib/deps_on_git_repo.ex") =~ "GitRepo.hello()"
411-
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.fetch")
411+
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.elixir_scm")
412412
end)
413413
after
414414
purge([GitRepo, GitRepo.MixProject])
@@ -441,7 +441,7 @@ defmodule Mix.Tasks.DepsGitTest do
441441
assert File.exists?("deps/git_repo/lib/git_repo.ex")
442442
assert File.read!("mix.lock") =~ last
443443
assert File.read!("deps/deps_on_git_repo/lib/deps_on_git_repo.ex") =~ "GitRepo.hello()"
444-
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.fetch")
444+
refute File.exists?("_build/dev/lib/git_repo/.mix/compile.elixir_scm")
445445
end)
446446
after
447447
purge([GitRepo, GitRepo.MixProject])

lib/mix/test/mix/tasks/deps_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ defmodule Mix.Tasks.DepsTest do
740740
Mix.Task.clear()
741741

742742
msg =
743-
" the dependency was built with an out-of-date Elixir version, run \"mix deps.compile\""
743+
" the dependency was built with an out-of-date Erlang/Elixir version, run \"mix deps.compile\""
744744

745745
Mix.Tasks.Deps.run([])
746746
assert_received {:mix_shell, :info, [^msg]}

0 commit comments

Comments
 (0)