Update Elixir and Erlang versions (#2892)

This commit is contained in:
Jonatan Kłosko 2024-12-11 16:22:01 +01:00 committed by GitHub
parent eedb0a7e46
commit a7c8e9e1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 26 additions and 58 deletions

View file

@ -10,7 +10,6 @@ jobs:
runs-on: ubuntu-latest
env:
MIX_ENV: test
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
steps:
- name: Checkout git repo
uses: actions/checkout@v4
@ -65,7 +64,6 @@ jobs:
if: github.event_name == 'push'
env:
MIX_ENV: test
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
steps:
- name: Configure Git
run: git config --global core.autocrlf input

View file

@ -10,7 +10,7 @@ defmodule Livebook.Application do
ensure_directories!()
set_local_file_system!()
validate_epmd_module!()
set_epmd_module!()
start_distribution!()
set_cookie()
@ -125,19 +125,28 @@ defmodule Livebook.Application do
:persistent_term.put(:livebook_local_file_system, local_file_system)
end
defp validate_epmd_module!() do
defp set_epmd_module!() do
# We use a custom EPMD module. In releases and Escript, we make
# sure the necessary erl flags are set. When running from source,
# those need to be passed explicitly.
# we try to use the new :kernel configuration available in OTP 27.2,
# otherwise it needs to be set explicitly.
# TODO: always rely on :kernel configuration once we require OTP 27.2
case :init.get_argument(:epmd_module) do
{:ok, [[~c"Elixir.Livebook.EPMD"]]} ->
:ok
_ ->
Livebook.Config.abort!("""
You must set the environment variable ELIXIR_ERL_OPTIONS="-epmd_module Elixir.Livebook.EPMD" \
before the command (and exclusively before the command)
""")
Application.put_env(:kernel, :epmd_module, Livebook.EPMD, persistent: true)
# Note: this is a private API
if :net_kernel.epmd_module() != Livebook.EPMD do
Livebook.Config.abort!("""
You must set the environment variable ELIXIR_ERL_OPTIONS="-epmd_module Elixir.Livebook.EPMD" \
before the command (and exclusively before the command)
""")
end
end
end

View file

@ -742,7 +742,7 @@ defmodule Livebook.Intellisense.IdentifierMatcher do
defp function_or_macro(_, fun, arity), do: {fun, arity, :function}
defp append_funs_type(funs, type) do
Enum.map(funs, &Tuple.append(&1, type))
Enum.map(funs, fn {name, arity} -> {name, arity, type} end)
end
defp match_module_type(mod, hint, ctx) do

View file

@ -177,38 +177,6 @@ defmodule Livebook.K8s.Pod do
end
defp access_main_container() do
access_find(&(&1["name"] == @main_container_name))
end
# TODO: use Access.find/1 once we require Elixir v1.17
defp access_find(predicate) when is_function(predicate, 1) do
fn op, data, next -> find(op, data, predicate, next) end
end
defp find(:get, data, predicate, next) when is_list(data) do
data |> Enum.find(predicate) |> next.()
end
defp find(:get_and_update, data, predicate, next) when is_list(data) do
get_and_update_find(data, [], predicate, next)
end
defp find(_op, data, _predicate, _next) do
raise "Access.find/1 expected a list, got: #{inspect(data)}"
end
defp get_and_update_find([], updates, _predicate, _next) do
{nil, :lists.reverse(updates)}
end
defp get_and_update_find([head | rest], updates, predicate, next) do
if predicate.(head) do
case next.(head) do
{get, update} -> {get, :lists.reverse([update | updates], rest)}
:pop -> {head, :lists.reverse(updates, rest)}
end
else
get_and_update_find(rest, [head | updates], predicate, next)
end
Access.find(&(&1["name"] == @main_container_name))
end
end

View file

@ -345,7 +345,7 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpers do
defp max_length_per_column(cell_grid) do
cell_grid
|> List.zip()
|> Enum.zip()
|> Enum.map(&Tuple.to_list/1)
|> Enum.map(fn cells ->
cells

View file

@ -855,7 +855,7 @@ defmodule Livebook.Runtime.ErlDist.RuntimeServer do
# We propagate Mix.install/2 project dir in the transient state,
# so that future runtimes can set it as the starting point for
# Mix.install/2
if dir = state.mix_install_project_dir == nil && install_project_dir() do
if dir = state.mix_install_project_dir == nil && Mix.install_project_dir() do
send(state.owner, {:runtime_transient_state, %{mix_install_project_dir: dir}})
%{state | mix_install_project_dir: dir}
else
@ -863,13 +863,6 @@ defmodule Livebook.Runtime.ErlDist.RuntimeServer do
end
end
defp install_project_dir() do
# TODO: remove the check once we require Elixir v1.16.2
if Code.ensure_loaded?(Mix) && function_exported?(Mix, :install_project_dir, 0) do
Mix.install_project_dir()
end
end
defp scan_binding_async(_ref, %{scan_binding: nil} = info, _state), do: info
# We wait for the current scanning to finish, this way we avoid

View file

@ -5,7 +5,7 @@ end
defmodule Livebook.MixProject do
use Mix.Project
@elixir_requirement "~> 1.16"
@elixir_requirement "~> 1.18.0-rc.0"
@version "0.15.0-dev"
@description "Automate code & data workflows with interactive notebooks"

View file

@ -697,7 +697,7 @@ defmodule Livebook.Runtime.EvaluatorTest do
%{
column: 6,
details:
"\e[31m** (Protocol.UndefinedError) protocol Enumerable not implemented for 1 of type Integer. " <>
"\e[31m** (Protocol.UndefinedError) protocol Enumerable not implemented for type Integer. " <>
_,
end_line: 10,
line: 9,
@ -1565,7 +1565,7 @@ defmodule Livebook.Runtime.EvaluatorTest do
in function list_to_binary/1
called as list_to_binary(1)
*** argument 1: not an iolist term
in call from erl_eval:do_apply/7 (erl_eval.erl, line 900)\
in call from erl_eval:do_apply/7 (erl_eval.erl, line 915)\
"""
end
end

View file

@ -1,5 +1,5 @@
elixir="1.17.2"
otp="27.0"
elixir="1.18.0-rc.0"
otp="27.2"
openssl="1.1.1s"
rebar3="3.22.0"
ubuntu="jammy-20240530"
ubuntu="jammy-20240808"