Skip to content

Commit d941fe0

Browse files
author
José Valim
committed
Store all manifests in a single .mix directory
1 parent 11989be commit d941fe0

24 files changed

+94
-82
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ defmodule Mix.Compilers.Elixir do
433433

434434
for %{scm: scm, opts: opts} = dep <- Mix.Dep.cached(),
435435
not scm.fetchable?,
436-
Mix.Utils.last_modified(Path.join(opts[:build], base)) > modified,
436+
Mix.Utils.last_modified(Path.join([opts[:build], ".mix", base])) > modified,
437437
path <- Mix.Dep.load_paths(dep),
438438
beam <- Path.wildcard(Path.join(path, "*.beam")),
439439
Mix.Utils.last_modified(beam) > modified,

lib/mix/lib/mix/compilers/erlang.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule Mix.Compilers.Erlang do
1717
For example, a simple compiler for Lisp Flavored Erlang
1818
would be implemented like:
1919
20-
manifest = Path.join Mix.Project.manifest_path, ".compile.lfe"
20+
manifest = Path.join Mix.Project.manifest_path, "compile.lfe"
2121
dest = Mix.Project.compile_path
2222
2323
compile manifest, [{"src", dest}], :lfe, :beam, opts, fn input, output ->
@@ -221,7 +221,7 @@ defmodule Mix.Compilers.Erlang do
221221
end
222222

223223
defp write_manifest(file, entries, timestamp) do
224-
Path.dirname(file) |> File.mkdir_p!()
224+
File.mkdir_p!(Path.dirname(file))
225225
File.write!(file, :erlang.term_to_binary({@manifest_vsn, entries}))
226226
File.touch!(file, timestamp)
227227
end

lib/mix/lib/mix/compilers/test.ex

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule Mix.Compilers.Test do
1111
runtime_references: [],
1212
external: []
1313

14-
@stale_manifest ".compile.test_stale"
14+
@stale_manifest "compile.test_stale"
1515
@manifest_vsn 1
1616

1717
@doc """
@@ -183,23 +183,15 @@ defmodule Mix.Compilers.Test do
183183
end
184184

185185
defp write_manifest([]) do
186-
manifest()
187-
|> File.rm()
188-
186+
File.rm(manifest())
189187
:ok
190188
end
191189

192190
defp write_manifest(sources) do
193191
manifest = manifest()
192+
File.mkdir_p!(Path.dirname(manifest))
194193

195-
manifest
196-
|> Path.dirname()
197-
|> File.mkdir_p!()
198-
199-
manifest_data =
200-
[@manifest_vsn | sources]
201-
|> :erlang.term_to_binary([:compressed])
202-
194+
manifest_data = :erlang.term_to_binary([@manifest_vsn | sources], [:compressed])
203195
File.write!(manifest, manifest_data)
204196
end
205197

lib/mix/lib/mix/dep.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ defmodule Mix.Dep do
336336
defp check_manifest(%{scm: scm} = dep, build_path) do
337337
vsn = {System.version(), :erlang.system_info(:otp_release)}
338338

339-
case Mix.Dep.ElixirSCM.read(build_path) do
339+
case Mix.Dep.ElixirSCM.read(Path.join(build_path, ".mix")) do
340340
{:ok, old_vsn, _} when old_vsn != vsn ->
341341
%{dep | status: {:elixirlock, old_vsn}}
342342

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Manifest file where we treat Elixir and SCMs as a dependency.
22
defmodule Mix.Dep.ElixirSCM do
33
@moduledoc false
4-
@manifest ".compile.elixir_scm"
4+
@manifest "compile.elixir_scm"
55
@manifest_vsn 1
66

77
def manifest(manifest_path \\ Mix.Project.manifest_path()) do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ defmodule Mix.Dep.Loader do
379379
scm.fetchable? &&
380380
Mix.Utils.stale?(
381381
join_stale(opts, :dest, ".fetch"),
382-
join_stale(opts, :build, ".compile.fetch")
382+
join_stale(opts, :build, ".mix/compile.fetch")
383383
)
384384
end
385385

lib/mix/lib/mix/dep/lock.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
defmodule Mix.Dep.Lock do
66
@moduledoc false
77

8-
@manifest ".compile.lock"
8+
@manifest "compile.lock"
99

1010
@doc """
1111
Returns the manifest file for dependencies.
@@ -32,11 +32,13 @@ defmodule Mix.Dep.Lock do
3232
"""
3333
@spec read() :: map
3434
def read() do
35-
case File.read(lockfile()) do
35+
lockfile = lockfile()
36+
37+
case File.read(lockfile) do
3638
{:ok, info} ->
37-
assert_no_merge_conflicts_in_lockfile(lockfile(), info)
39+
assert_no_merge_conflicts_in_lockfile(lockfile, info)
3840

39-
case Code.eval_string(info, [], file: lockfile()) do
41+
case Code.eval_string(info, [], file: lockfile) do
4042
{lock, _binding} when is_map(lock) -> lock
4143
{_, _binding} -> %{}
4244
end

lib/mix/lib/mix/project.ex

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,17 +448,20 @@ defmodule Mix.Project do
448448
## Examples
449449
450450
Mix.Project.manifest_path
451-
#=> "/path/to/project/_build/shared/lib/app"
451+
#=> "/path/to/project/_build/shared/lib/app/.mix"
452452
453453
"""
454454
@spec manifest_path(keyword) :: Path.t()
455455
def manifest_path(config \\ config()) do
456-
config[:app_path] ||
457-
if app = config[:app] do
458-
Path.join([build_path(config), "lib", Atom.to_string(app)])
459-
else
460-
build_path(config)
461-
end
456+
app_path =
457+
config[:app_path] ||
458+
if app = config[:app] do
459+
Path.join([build_path(config), "lib", Atom.to_string(app)])
460+
else
461+
build_path(config)
462+
end
463+
464+
Path.join(app_path, ".mix")
462465
end
463466

464467
@doc """

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Mix.Tasks.Compile.Elixir do
22
use Mix.Task.Compiler
33

44
@recursive true
5-
@manifest ".compile.elixir"
5+
@manifest "compile.elixir"
66

77
@moduledoc """
88
Compiles Elixir source files.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Mix.Tasks.Compile.Erlang do
33
import Mix.Compilers.Erlang
44

55
@recursive true
6-
@manifest ".compile.erlang"
6+
@manifest "compile.erlang"
77
@switches [force: :boolean, all_warnings: :boolean]
88

99
@moduledoc """

0 commit comments

Comments
 (0)