Skip to content

Commit bcc7082

Browse files
authored
Require Elixir v1.15 for Phoenix (#6032)
* Require Elixir v1.15 for Phoenix * Update mix.exs
1 parent 5c8b7e9 commit bcc7082

File tree

5 files changed

+45
-78
lines changed

5 files changed

+45
-78
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
include:
16-
- elixir: 1.11.4
17-
otp: 24.3
18-
19-
- elixir: 1.12.3
20-
otp: 24.3
21-
22-
- elixir: 1.14.5
23-
otp: 25.3.2.9
24-
25-
- elixir: 1.15.x
26-
otp: 25.x
16+
- elixir: 1.15.8
17+
otp: 24.3.4.17
2718

2819
- elixir: 1.17.3
2920
otp: 27.2
@@ -33,43 +24,43 @@ jobs:
3324
runs-on: ubuntu-20.04
3425

3526
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v4
38-
39-
- name: Set up Elixir
40-
uses: erlef/setup-beam@v1
41-
with:
42-
elixir-version: ${{ matrix.elixir }}
43-
otp-version: ${{ matrix.otp }}
44-
45-
- name: Restore deps and _build cache
46-
uses: actions/cache@v4
47-
with:
48-
path: |
49-
deps
50-
_build
51-
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
52-
restore-keys: |
53-
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
54-
55-
- name: Install dependencies
56-
run: mix deps.get --only test
57-
58-
- name: Remove compiled application files
59-
run: mix clean
60-
61-
- name: Compile & lint dependencies
62-
run: mix compile --warnings-as-errors
63-
if: ${{ matrix.lint }}
64-
65-
- name: Run tests
66-
run: mix test
67-
68-
- name: Run installer test
69-
run: |
70-
cd installer
71-
mix test
72-
if: ${{ matrix.installer }}
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Elixir
31+
uses: erlef/setup-beam@v1
32+
with:
33+
elixir-version: ${{ matrix.elixir }}
34+
otp-version: ${{ matrix.otp }}
35+
36+
- name: Restore deps and _build cache
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
deps
41+
_build
42+
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
43+
restore-keys: |
44+
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
45+
46+
- name: Install dependencies
47+
run: mix deps.get --only test
48+
49+
- name: Remove compiled application files
50+
run: mix clean
51+
52+
- name: Compile & lint dependencies
53+
run: mix compile --warnings-as-errors
54+
if: ${{ matrix.lint }}
55+
56+
- name: Run tests
57+
run: mix test
58+
59+
- name: Run installer test
60+
run: |
61+
cd installer
62+
mix test
63+
if: ${{ matrix.installer }}
7364

7465
npm_test:
7566
name: npm test

lib/phoenix/code_reloader/server.ex

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,6 @@ defmodule Phoenix.CodeReloader.Server do
182182
end
183183
end
184184

185-
if Version.match?(System.version(), "< 1.15.0-dev") do
186-
defp purge_protocols(path) do
187-
purge_modules(path)
188-
Code.delete_path(path)
189-
end
190-
else
191-
defp purge_protocols(_path), do: :ok
192-
end
193-
194185
if Version.match?(System.version(), ">= 1.18.0-dev") do
195186
defp warn_missing_mix_listener do
196187
if Mix.Project.get() != Phoenix.MixProject do
@@ -226,11 +217,6 @@ defmodule Phoenix.CodeReloader.Server do
226217
config = Mix.Project.config()
227218
path = Mix.Project.consolidation_path(config)
228219

229-
# TODO: Remove this conditional when requiring Elixir v1.15+
230-
if config[:consolidate_protocols] do
231-
purge_protocols(path)
232-
end
233-
234220
mix_compile_deps(
235221
Mix.Dep.cached(),
236222
apps_to_reload,
@@ -364,7 +350,7 @@ defmodule Phoenix.CodeReloader.Server do
364350
exit({:shutdown, 1})
365351

366352
result == :ok && config[:consolidate_protocols] ->
367-
# TODO: Calling compile.protocols may no longer be required from Elixir v1.18
353+
# TODO: Calling compile.protocols is no longer be required from Elixir v1.19
368354
Mix.Task.reenable("compile.protocols")
369355
Mix.Task.run("compile.protocols", [])
370356
:ok

lib/phoenix/router.ex

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,7 @@ defmodule Phoenix.Router do
523523
"""
524524
def call(conn, _opts) do
525525
%{method: method, path_info: path_info, host: host} = conn = prepare(conn)
526-
527-
# TODO: Remove try/catch on Elixir v1.13 as decode no longer raises
528-
decoded =
529-
try do
530-
Enum.map(path_info, &URI.decode/1)
531-
rescue
532-
ArgumentError ->
533-
raise MalformedURIError, "malformed URI path: #{inspect(conn.request_path)}"
534-
end
526+
decoded = Enum.map(path_info, &URI.decode/1)
535527

536528
case __match_route__(decoded, method, host) do
537529
{metadata, prepare, pipeline, plug_opts} ->

lib/phoenix/socket/pool_supervisor.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ defmodule Phoenix.Socket.PoolSupervisor do
4545

4646
@impl true
4747
def init({endpoint, name, partitions}) do
48-
# TODO: Use persistent term on Elixir v1.12+
4948
ref = :ets.new(name, [:public, read_concurrency: true])
5049
:ets.insert(ref, {:partitions, partitions})
5150
Phoenix.Config.permanent(endpoint, {:socket, name}, ref)
@@ -115,8 +114,7 @@ defmodule Phoenix.Socket.PoolDrainer do
115114
end
116115

117116
for {pids, index} <-
118-
collection |> Stream.concat() |> Stream.chunk_every(size) |> Stream.with_index(1) do
119-
117+
collection |> Stream.concat() |> Stream.chunk_every(size) |> Stream.with_index(1) do
120118
spawn(fn ->
121119
for pid <- pids do
122120
send(pid, %Phoenix.Socket.Broadcast{event: "phx_drain"})

mix.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Phoenix.MixProject do
1414
# If the elixir requirement is updated, we need to make the installer
1515
# use at least the minimum requirement used here. Although often the
1616
# installer is ahead of Phoenix itself.
17-
@elixir_requirement "~> 1.11"
17+
@elixir_requirement "~> 1.15"
1818

1919
def project do
2020
[
@@ -86,9 +86,9 @@ defmodule Phoenix.MixProject do
8686
{:phoenix_template, "~> 1.0"},
8787
{:websock_adapter, "~> 0.5.3"},
8888

89-
# TODO drop phoenix_view as an optional dependency in Phoenix v2.0
89+
# TODO Drop phoenix_view as an optional dependency in Phoenix v2.0
9090
{:phoenix_view, "~> 2.0", optional: true},
91-
# TODO drop castore when we require OTP 25+
91+
# TODO Drop castore when we require OTP 25+ / Elixir v1.17+
9292
{:castore, ">= 0.0.0"},
9393

9494
# Optional deps

0 commit comments

Comments
 (0)