Skip to content

Commit

Permalink
require Elixir 1.15+ in new apps
Browse files Browse the repository at this point in the history
Closes #5276.
  • Loading branch information
SteffenDE committed Oct 22, 2024
1 parent a6328f1 commit 18e1bf2
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- elixir: 1.14.5
otp: 25.3.2.9

- elixir: 1.17.2
otp: 27.0
- elixir: 1.17.3
otp: 27.1
lint: true
installer: true

Expand Down
4 changes: 2 additions & 2 deletions guides/deployment/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ The buildpack uses a predefined Elixir and Erlang version, but to avoid surprise

```console
# Elixir version
elixir_version=1.14.0
elixir_version=1.15.0

# Erlang version
# https://github.com/HashNuke/heroku-buildpack-elixir-otp-builds/blob/master/otp-versions
erlang_version=24.3
erlang_version=25.3

# Invoke assets.deploy defined in your mix.exs to deploy assets with esbuild
# Note we nuke the esbuild executable from the image
Expand Down
8 changes: 4 additions & 4 deletions guides/deployment/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ If you call `mix phx.gen.release --docker` you'll see a new file with these cont
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20230612-slim - for the release image
# - https://pkgs.org/ - resource for finding needed packages
# - Ex: hexpm/elixir:1.14.5-erlang-25.3.2.4-debian-bullseye-20230612-slim
# - Ex: hexpm/elixir:1.15.8-erlang-25.3.2.15-debian-bookworm-20241016-slim
#
ARG ELIXIR_VERSION=1.14.5
ARG OTP_VERSION=25.3.2.4
ARG DEBIAN_VERSION=bullseye-20230612-slim
ARG ELIXIR_VERSION=1.15.8
ARG OTP_VERSION=25.3.2.15
ARG DEBIAN_VERSION=bookworm-20241016-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
Expand Down
6 changes: 3 additions & 3 deletions guides/introduction/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In order to build a Phoenix application, we will need a few dependencies install

Please take a look at this list and make sure to install anything necessary for your system. Having dependencies installed in advance can prevent frustrating problems later on.

## Elixir 1.14 or later
## Elixir 1.15 or later

Phoenix is written in Elixir, and our application code will also be written in Elixir. We won't get far in a Phoenix app without it! The Elixir site maintains a great [Installation Page](https://elixir-lang.org/install.html) to help.

Expand All @@ -28,13 +28,13 @@ When we install Elixir using instructions from the Elixir [Installation Page](ht

## Phoenix

To check that we are on Elixir 1.14 and Erlang 24 or later, run:
To check that we are on Elixir 1.15 and Erlang 24 or later, run:

```console
elixir -v
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.14.0
Elixir 1.15.0
```

Once we have Elixir and Erlang, we are ready to install the Phoenix application generator:
Expand Down
25 changes: 4 additions & 21 deletions installer/lib/mix/tasks/phx.new.ex
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ defmodule Mix.Tasks.Phx.New do
Task.async(fn -> cmd(project, cmd, log: false, cd: project.web_path) end)
end)

if rebar_available?() do
cmd(project, "mix deps.compile")
end
cmd(project, "mix deps.compile")

Task.await_many(tasks, :infinity)
end
Expand Down Expand Up @@ -254,28 +252,13 @@ defmodule Mix.Tasks.Phx.New do
defp maybe_cd(path, func), do: path && File.cd!(path, func)

defp install_mix(project, install?) do
if install? && hex_available?() do
if install? do
cmd(project, "mix deps.get")
else
["$ mix deps.get"]
end
end

# TODO: Elixir v1.15 automatically installs Hex/Rebar if missing, so we can simplify this.
defp hex_available? do
Code.ensure_loaded?(Hex)
end

if Version.match?(System.version(), "~> 1.18") do
defp rebar_available? do
true
end
else
defp rebar_available? do
Mix.Rebar.rebar_cmd(:rebar3)
end
end

defp print_missing_steps(steps) do
Mix.shell().info("""
Expand Down Expand Up @@ -395,9 +378,9 @@ defmodule Mix.Tasks.Phx.New do
end

defp elixir_version_check! do
unless Version.match?(System.version(), "~> 1.14") do
unless Version.match?(System.version(), "~> 1.15") do
Mix.raise(
"Phoenix v#{@version} requires at least Elixir v1.14\n " <>
"Phoenix v#{@version} requires at least Elixir v1.15\n " <>
"You have #{System.version()}. Please update accordingly"
)
end
Expand Down
2 changes: 1 addition & 1 deletion installer/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Phx.New.MixProject do
# 4. test/test_helper.exs at the root
# 5. installer/lib/mix/tasks/phx.new.ex
#
@elixir_requirement "~> 1.14"
@elixir_requirement "~> 1.15"

def project do
[
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_single/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ config :tailwind,
]<% end %>

# Configures Elixir's Logger
config :logger, :console,
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_single/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule <%= @app_module %>.MixProject do
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",<% end %>
elixir: "~> 1.14",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/apps/app_name/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule <%= @app_module %>.MixProject do
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.14",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/apps/app_name_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule <%= @web_namespace %>.MixProject do
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.14",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Config

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
config :logger, :default_formatter, format: "[$level] $message\n"

# Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime<%= if @html do %>
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/config/extra_config.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Config

# Configures Elixir's Logger
config :logger, :console,
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

Expand Down
2 changes: 1 addition & 1 deletion integration_test/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Phoenix.Integration.MixProject do
[
app: :phoenix_integration,
version: "0.1.0",
elixir: "~> 1.14",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps()
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ assert_timeout = String.to_integer(
)

excludes =
if Version.match?(System.version(), "~> 1.14") do
if Version.match?(System.version(), "~> 1.15") do
[]
else
[:mix_phx_new]
Expand Down

0 comments on commit 18e1bf2

Please sign in to comment.