Skip to content

Commit f8c6054

Browse files
committed
Deprecate --no-protocol-consolidation
1 parent ed825c3 commit f8c6054

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

lib/mix/lib/mix/compilers/protocol.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ defmodule Mix.Compilers.Protocol do
55

66
## Umbrella handling
77

8+
@switches [force: :boolean, verbose: :boolean, consolidate_protocols: :boolean]
9+
810
def umbrella(args, res) do
911
config = Mix.Project.config()
10-
{opts, _, _} = OptionParser.parse(args, switches: [force: :boolean, verbose: :boolean])
12+
{opts, _, _} = OptionParser.parse(args, switches: @switches)
1113

1214
opts =
1315
if "--no-protocol-consolidation" in args do
16+
# TODO: Deprecate me on Elixir v1.23
1417
Keyword.put(opts, :consolidate_protocols, false)
1518
else
16-
Keyword.take(config, [:consolidate_protocols]) ++ opts
19+
opts ++ Keyword.take(config, [:consolidate_protocols])
1720
end
1821

1922
manifest = manifest()

lib/mix/lib/mix/tasks/archive.build.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ defmodule Mix.Tasks.Archive.Build do
6363
if project && Keyword.get(opts, :compile, true) do
6464
# We only care about the archive ebin, so we disable protocol
6565
# consolidation to avoid further changes to the environment.
66-
Mix.Task.run(:compile, ["--no-protocol-consolidation" | args])
66+
Mix.Task.run(:compile, ["--no-consolidate-protocols" | args])
6767
end
6868

6969
source =

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ defmodule Mix.Tasks.Compile.Elixir do
9090
@switches [
9191
force: :boolean,
9292
docs: :boolean,
93+
consolidate_protocols: :boolean,
9394
warnings_as_errors: :boolean,
9495
ignore_module_conflict: :boolean,
9596
debug_info: :boolean,
@@ -126,6 +127,7 @@ defmodule Mix.Tasks.Compile.Elixir do
126127

127128
opts =
128129
if "--no-protocol-consolidation" in args do
130+
# TODO: Deprecate me on Elixir v1.23
129131
Keyword.put(opts, :consolidate_protocols, false)
130132
else
131133
opts

lib/mix/lib/mix/tasks/compile.protocols.ex

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

5-
# TODO: Warn on Elixir v1.23
5+
# TODO: Deprecate me on Elixir v1.23
66
def run(_args) do
77
:noop
88
end

lib/mix/test/mix/tasks/compile_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ defmodule Mix.Tasks.CompileTest do
224224
end)
225225
end
226226

227-
test "skip protocol consolidation when --no-protocol-consolidation" do
227+
test "skip protocol consolidation when --no-consolidate-protocols" do
228228
in_fixture("no_mixfile", fn ->
229229
File.rm("_build/dev/lib/sample/.mix/compile.protocols")
230-
assert Mix.Task.run("compile", ["--no-protocol-consolidation"]) == {:ok, []}
230+
assert Mix.Task.run("compile", ["--no-consolidate-protocols"]) == {:ok, []}
231231
assert File.regular?("_build/dev/lib/sample/ebin/Elixir.A.beam")
232232
refute File.regular?("_build/dev/lib/sample/consolidated/Elixir.Enumerable.beam")
233233
end)
@@ -283,7 +283,7 @@ defmodule Mix.Tasks.CompileTest do
283283
Mix.Project.push(WrongPath)
284284

285285
ExUnit.CaptureIO.capture_io(fn ->
286-
assert Mix.Task.run("compile", ["--no-protocol-consolidation"]) == {:noop, []}
286+
assert Mix.Task.run("compile", ["--no-consolidate-protocols"]) == {:noop, []}
287287
end)
288288
end
289289

0 commit comments

Comments
 (0)