Skip to content

Commit dc393ed

Browse files
author
José Valim
committed
No need to store environment in .compile.lock
1 parent cbae2ae commit dc393ed

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

lib/mix/lib/mix/deps/lock.ex

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule Mix.Deps.Lock do
2626
"""
2727
def touch(manifest_path) do
2828
File.mkdir_p!(manifest_path)
29-
File.write!(Path.join(manifest_path, @manifest), "#{System.version}\n#{Mix.env}")
29+
File.write!(Path.join(manifest_path, @manifest), System.version)
3030
end
3131

3232
@doc """
@@ -40,30 +40,11 @@ defmodule Mix.Deps.Lock do
4040
Returns the elixir version in the lock manifest in the given path.
4141
"""
4242
def elixir_vsn(manifest_path) do
43-
read_manifest(manifest_path) |> elem(0)
44-
end
45-
46-
@doc """
47-
Returns the mix env in the lock manifest unless it is an umbrella app.
48-
"""
49-
def mix_env() do
50-
unless Mix.Project.umbrella?, do: mix_env(Mix.Project.manifest_path)
51-
end
52-
53-
@doc """
54-
Returns the mix env version in the lock manifest in the given path.
55-
"""
56-
def mix_env(manifest_path) do
57-
read_manifest(manifest_path) |> elem(1)
58-
end
59-
60-
defp read_manifest(manifest_path) do
6143
case File.read(manifest(manifest_path)) do
6244
{ :ok, contents } ->
63-
destructure [vsn, env], String.split(contents, "\n")
64-
{ vsn, env }
45+
contents
6546
{ :error, _ } ->
66-
{ nil, nil }
47+
nil
6748
end
6849
end
6950

lib/mix/test/mix/deps/lock_test.exs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ defmodule Mix.Deps.LockTest do
2626
end
2727
end
2828

29-
test "stores version and env in manifest" do
29+
test "stores version in manifest" do
3030
in_fixture "no_mixfile", fn ->
3131
assert nil? Mix.Deps.Lock.elixir_vsn
32-
assert nil? Mix.Deps.Lock.mix_env
33-
3432
Mix.Deps.Lock.touch
35-
3633
assert Mix.Deps.Lock.elixir_vsn == System.version
37-
assert Mix.Deps.Lock.mix_env == "dev"
3834
end
3935
end
4036
end

0 commit comments

Comments
 (0)