Skip to content

Commit 808a816

Browse files
Merge pull request #8748 from rabbitmq/rin/add-elixir-1.15.0
Add elixir 1.15.2
2 parents 6a395c3 + 1be7b00 commit 808a816

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+180
-107
lines changed

MODULE.bazel

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bazel_dep(
3131

3232
bazel_dep(
3333
name = "rules_erlang",
34-
version = "3.10.5",
34+
version = "3.11.1",
3535
)
3636

3737
bazel_dep(
@@ -111,6 +111,12 @@ elixir_config.internal_elixir_from_github_release(
111111
version = "1.14.5",
112112
)
113113

114+
elixir_config.internal_elixir_from_github_release(
115+
name = "1_15",
116+
sha256 = "3cfadca57c3092ccbd3ec3f17e5eab529bbd2946f50e4941a903c55c39e3c5f5",
117+
version = "1.15.2",
118+
)
119+
114120
use_repo(
115121
elixir_config,
116122
"elixir_config",
@@ -134,6 +140,7 @@ register_toolchains(
134140
"@elixir_config//external:toolchain",
135141
"@elixir_config//1_13:toolchain",
136142
"@elixir_config//1_14:toolchain",
143+
"@elixir_config//1_15:toolchain",
137144
)
138145

139146
erlang_package = use_extension(
@@ -382,6 +389,8 @@ erlang_dev_package.hex_package(
382389
build_file = "@rabbitmq-server//bazel:BUILD.amqp",
383390
sha256 = "b6d926770e4508e30e3e9e476c57b6c8aeda44f7715663bdc38935620ce5be6f",
384391
version = "2.1.1",
392+
patch_args = ["-p1"],
393+
patches = ["@rabbitmq-server//bazel:amqp.patch"],
385394
)
386395

387396
erlang_dev_package.git_package(
@@ -433,8 +442,8 @@ erlang_dev_package.hex_package(
433442
erlang_dev_package.hex_package(
434443
name = "x509",
435444
build_file = "@rabbitmq-server//bazel:BUILD.x509",
436-
sha256 = "5ff9c79e77d64a62ccffd90aaeb23e8f5b6e47844ef7bc8fed931ecf238662e0",
437-
version = "0.7.0",
445+
sha256 = "3604125d6a0171da6e8a935810b58c999fccab0e3d20b2ed28d97fa2d9e2f6b4",
446+
version = "0.8.7",
438447
)
439448

440449
use_repo(

WORKSPACE

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rules_pkg_dependencies()
1919
git_repository(
2020
name = "rules_erlang",
2121
remote = "https://github.com/rabbitmq/rules_erlang.git",
22-
tag = "3.10.5",
22+
tag = "3.11.1",
2323
)
2424

2525
load("@rules_erlang//:internal_deps.bzl", "rules_erlang_internal_deps")
@@ -182,6 +182,11 @@ elixir_config(
182182
sha256 = "2ea249566c67e57f8365ecdcd0efd9b6c375f57609b3ac2de326488ac37c8ebd",
183183
version = "1.14.5",
184184
),
185+
internal_elixir_from_github_release(
186+
name = "1_15",
187+
sha256 = "3cfadca57c3092ccbd3ec3f17e5eab529bbd2946f50e4941a903c55c39e3c5f5",
188+
version = "1.15.2",
189+
),
185190
],
186191
rabbitmq_server_workspace = "@",
187192
)

bazel/amqp.patch

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/lib/amqp/core.ex b/lib/amqp/core.ex
2+
index a7302aa..abf2be6 100644
3+
--- a/lib/amqp/core.ex
4+
+++ b/lib/amqp/core.ex
5+
@@ -3,6 +3,10 @@ defmodule AMQP.Core do
6+
7+
require Record
8+
9+
+ # Elixir 1.15 compiler optimizations require that we explicitly
10+
+ # add the rabbit_common code path
11+
+ true = :code.add_path(:filename.join(:os.getenv(~c"DEPS_DIR"), ~c"rabbit_common/ebin"))
12+
+
13+
Record.defrecord(
14+
:p_basic,
15+
:P_basic,

bazel/platforms/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ platform(
6060
name = "erlang_linux_26_platform",
6161
constraint_values = [
6262
"@erlang_config//:erlang_26",
63-
"@elixir_config//:elixir_1_14",
63+
"@elixir_config//:elixir_1_15",
6464
],
6565
parents = ["@rbe//config:platform"],
6666
)
@@ -69,7 +69,7 @@ platform(
6969
name = "erlang_linux_git_master_platform",
7070
constraint_values = [
7171
"@erlang_config//:erlang_27_unknown",
72-
"@elixir_config//:elixir_1_14",
72+
"@elixir_config//:elixir_1_15",
7373
],
7474
parents = ["@rbe//config:platform"],
7575
)

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ rabbitmqctl_check_formatted_test(
8181
]),
8282
data = glob(["test/fixtures/**/*"]),
8383
target_compatible_with = select({
84-
"@platforms//os:macos": ["@platforms//os:macos"],
85-
"//conditions:default": ["@platforms//os:linux"],
84+
"@platforms//os:macos": [
85+
"@platforms//os:macos",
86+
"@elixir_config//:elixir_1_15",
87+
],
88+
"//conditions:default": [
89+
"@platforms//os:linux",
90+
"@elixir_config//:elixir_1_15",
91+
],
8692
}),
8793
)
8894

deps/rabbitmq_cli/config/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Config
2424
#
2525
# Or configure a 3rd-party app:
2626
#
27-
config :logger, level: :warn, console: [device: :standard_error]
27+
config :logger, level: :warning, console: [device: :standard_error]
2828
#
2929

3030
# It is also possible to import configuration files, relative to this

deps/rabbitmq_cli/lib/rabbit_common/records.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ defmodule RabbitCommon.Records do
88
require Record
99
import Record, only: [defrecord: 2, extract: 2]
1010

11+
# Elixir 1.15 compiler optimizations require that we explicitly
12+
# add the rabbit_common code path
13+
true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "rabbit_common", "ebin"]))
14+
1115
# Important: amqqueue records must not be used directly since they are versioned
1216
# for mixed version cluster compatibility. Convert records
1317
# to maps on the server end to access the fields of those records. MK.

deps/rabbitmq_cli/lib/rabbitmq/cli/core/code_path.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ defmodule RabbitMQ.CLI.Core.CodePath do
6161

6262
case :erl_prim_loader.list_dir(app_dir) do
6363
{:ok, list} ->
64-
case Enum.member?(list, 'ebin') do
64+
case Enum.member?(list, ~c"ebin") do
6565
true ->
66-
ebin_dir = :filename.join(app_dir, 'ebin')
66+
ebin_dir = :filename.join(app_dir, ~c"ebin")
6767
Code.append_path(ebin_dir)
6868

6969
false ->

deps/rabbitmq_cli/lib/rabbitmq/cli/core/config.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule RabbitMQ.CLI.Core.Config do
4444

4545
def normalise(:longnames, true), do: :longnames
4646
def normalise(:longnames, "true"), do: :longnames
47-
def normalise(:longnames, 'true'), do: :longnames
47+
def normalise(:longnames, ~c"true"), do: :longnames
4848
def normalise(:longnames, "\"true\""), do: :longnames
4949
def normalise(:longnames, _val), do: :shortnames
5050
def normalise(_, value), do: value

deps/rabbitmq_cli/lib/rabbitmq/cli/core/listeners.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ defmodule RabbitMQ.CLI.Core.Listeners do
1313
# API
1414
#
1515

16+
# TODO: Remove when we require Elixir 1.15
17+
if function_exported?(Mix, :ensure_application!, 1) do
18+
Mix.ensure_application!(:public_key)
19+
end
20+
1621
defrecord :certificate,
1722
:Certificate,
1823
extract(:Certificate, from_lib: "public_key/include/public_key.hrl")

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/shutdown_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ShutdownCommand do
8484
#
8585

8686
def addressing_local_node?(_, remote_hostname) when remote_hostname == :localhost, do: true
87-
def addressing_local_node?(_, remote_hostname) when remote_hostname == 'localhost', do: true
87+
def addressing_local_node?(_, remote_hostname) when remote_hostname == ~c"localhost", do: true
8888
def addressing_local_node?(_, remote_hostname) when remote_hostname == "localhost", do: true
8989

9090
def addressing_local_node?(local_hostname, remote_hostname) do

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/wait_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.WaitCommand do
155155
end
156156

157157
defp wait_for_pid_funs(node_name, app_names, timeout, quiet) do
158-
app_names_formatted = :io_lib.format('~p', [app_names])
158+
app_names_formatted = :io_lib.format(~c"~p", [app_names])
159159

160160
[
161161
log_param(

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/remote_shell_command.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.RemoteShellCommand do
4747
defp start_shell_on_otp_25(node_name) do
4848
_ = Supervisor.terminate_child(:kernel_sup, :user)
4949
Process.flag(:trap_exit, true)
50-
user_drv = :user_drv.start(['tty_sl -c -e', {node_name, :shell, :start, []}])
50+
user_drv = :user_drv.start([~c"tty_sl -c -e", {node_name, :shell, :start, []}])
5151
Process.link(user_drv)
5252

5353
receive do
54-
{'EXIT', _user_drv, _} ->
54+
{~c"EXIT", _user_drv, _} ->
5555
{:ok, "Disconnected from #{node_name}."}
5656
end
5757
end

deps/rabbitmq_cli/lib/rabbitmq/cli/formatters/csv.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ defmodule RabbitMQ.CLI.Formatters.Csv do
9494
end
9595
end
9696

97+
# Elixir 1.15 compiler optimizations require that we explicitly
98+
# add the csv code path
99+
true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "csv", "ebin"]))
100+
97101
defimpl CSV.Encode, for: PID do
98102
def encode(pid, env \\ []) do
99103
FormatterHelpers.format_info_item(pid)

deps/rabbitmq_cli/lib/rabbitmq/cli/formatters/pretty_table.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ defmodule RabbitMQ.CLI.Formatters.PrettyTable do
1212
require Record
1313
import Record
1414

15+
# Elixir 1.15 compiler optimizations require that we explicitly
16+
# add the stdout_formatter code path
17+
true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "stdout_formatter", "ebin"]))
18+
1519
defrecord :table,
1620
extract(:table,
1721
from_lib: "stdout_formatter/include/stdout_formatter.hrl"

deps/rabbitmq_cli/lib/rabbitmqctl.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ defmodule RabbitMQCtl do
628628
## {:fun, fun} - run a custom function to enable distribution.
629629
## custom mode is usefult for commands which should have specific node name.
630630
## Runs code if distribution is successful, or not needed.
631-
@spec maybe_with_distribution(module(), options(), (() -> command_result())) :: command_result()
631+
@spec maybe_with_distribution(module(), options(), (-> command_result())) :: command_result()
632632
defp maybe_with_distribution(command, options, code) do
633633
try do
634634
maybe_with_distribution_without_catch(command, options, code)

deps/rabbitmq_cli/mix.exs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ defmodule RabbitMQCtl.MixfileBase do
135135
end
136136

137137
make_cmd = System.get_env("MAKE", "make")
138+
fake_cmd = "true"
138139
is_bazel = System.get_env("IS_BAZEL") != nil
139140

140141
[
@@ -149,17 +150,17 @@ defmodule RabbitMQCtl.MixfileBase do
149150
{
150151
:stdout_formatter,
151152
path: Path.join(deps_dir, "stdout_formatter"),
152-
compile: if(is_bazel, do: false, else: make_cmd)
153+
compile: if(is_bazel, do: fake_cmd, else: make_cmd)
153154
},
154155
{
155156
:observer_cli,
156157
path: Path.join(deps_dir, "observer_cli"),
157-
compile: if(is_bazel, do: false, else: make_cmd)
158+
compile: if(is_bazel, do: fake_cmd, else: make_cmd)
158159
},
159160
{
160161
:rabbit_common,
161162
path: Path.join(deps_dir, "rabbit_common"),
162-
compile: if(is_bazel, do: false, else: make_cmd),
163+
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
163164
override: true
164165
}
165166
] ++
@@ -174,6 +175,12 @@ defmodule RabbitMQCtl.MixfileBase do
174175
:dialyxir,
175176
path: Path.join(deps_dir, "dialyxir"), runtime: false
176177
},
178+
{
179+
:rabbit,
180+
path: Path.join(deps_dir, "rabbit"),
181+
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
182+
override: true
183+
},
177184
{
178185
:temp,
179186
path: Path.join(deps_dir, "temp")
@@ -185,7 +192,7 @@ defmodule RabbitMQCtl.MixfileBase do
185192
{
186193
:amqp_client,
187194
path: Path.join(deps_dir, "amqp_client"),
188-
compile: if(is_bazel, do: false, else: make_cmd),
195+
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
189196
override: true
190197
}
191198
]

deps/rabbitmq_cli/rabbitmqctl.bzl

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,35 @@ def deps_dir_contents(ctx, deps, dir):
3838
files = []
3939
for dep in deps:
4040
lib_info = dep[ErlangAppInfo]
41-
for src in lib_info.include + lib_info.beam + lib_info.srcs:
41+
files_by_path = {}
42+
for src in lib_info.include + lib_info.srcs:
4243
if not src.is_directory:
4344
rp = additional_file_dest_relative_path(dep.label, src)
45+
files_by_path[rp] = src
46+
else:
47+
fail("unexpected directory in", lib_info)
48+
for rp, src in files_by_path.items():
49+
f = ctx.actions.declare_file(path_join(
50+
dir,
51+
lib_info.app_name,
52+
rp,
53+
))
54+
ctx.actions.symlink(
55+
output = f,
56+
target_file = src,
57+
)
58+
files.extend([f, src])
59+
for beam in lib_info.beam:
60+
if not beam.is_directory:
4461
f = ctx.actions.declare_file(path_join(
45-
dir,
46-
lib_info.app_name,
47-
rp,
48-
))
62+
dir, lib_info.app_name, "ebin", beam.basename))
4963
ctx.actions.symlink(
5064
output = f,
51-
target_file = src,
65+
target_file = beam,
5266
)
53-
files.extend([src, f])
67+
files.extend([f, beam])
68+
else:
69+
fail("unexpected directory in", lib_info)
5470
return files
5571

5672
def _impl(ctx):
@@ -122,11 +138,6 @@ export ERL_COMPILER_OPTIONS=deterministic
122138
for archive in {archives}; do
123139
"${{ABS_ELIXIR_HOME}}"/bin/mix archive.install --force $ORIGINAL_DIR/$archive
124140
done
125-
for d in {precompiled_deps}; do
126-
mkdir -p _build/${{MIX_ENV}}/lib/$d
127-
ln -s ${{DEPS_DIR}}/$d/ebin _build/${{MIX_ENV}}/lib/$d
128-
ln -s ${{DEPS_DIR}}/$d/include _build/${{MIX_ENV}}/lib/$d
129-
done
130141
"${{ABS_ELIXIR_HOME}}"/bin/mix deps.compile
131142
"${{ABS_ELIXIR_HOME}}"/bin/mix compile
132143
"${{ABS_ELIXIR_HOME}}"/bin/mix escript.build

deps/rabbitmq_cli/rabbitmqctl_test.bzl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,9 @@ export ERL_COMPILER_OPTIONS=deterministic
100100
for archive in {archives}; do
101101
"${{ABS_ELIXIR_HOME}}"/bin/mix archive.install --force $INITIAL_DIR/$archive
102102
done
103-
for d in {precompiled_deps}; do
104-
mkdir -p _build/${{MIX_ENV}}/lib/$d
105-
ln -s ${{DEPS_DIR}}/$d/ebin _build/${{MIX_ENV}}/lib/$d
106-
ln -s ${{DEPS_DIR}}/$d/include _build/${{MIX_ENV}}/lib/$d
107-
done
108103
"${{ABS_ELIXIR_HOME}}"/bin/mix deps.compile
109104
"${{ABS_ELIXIR_HOME}}"/bin/mix compile
110105
111-
# due to https://github.com/elixir-lang/elixir/issues/7699 we
112-
# "run" the tests, but skip them all, in order to trigger
113-
# compilation of all *_test.exs files before we actually run them
114-
"${{ABS_ELIXIR_HOME}}"/bin/mix test --exclude test
115-
116106
export TEST_TMPDIR=${{TEST_UNDECLARED_OUTPUTS_DIR}}
117107
118108
# we need a running broker with certain plugins for this to pass
@@ -174,11 +164,6 @@ for %%a in ({archives}) do (
174164
set ARCH=%ARCH:/=\\%
175165
"{elixir_home}\\bin\\mix" archive.install --force %ARCH% || goto :error
176166
)
177-
for %%d in ({precompiled_deps}) do (
178-
mkdir _build\\%MIX_ENV%\\lib\\%%d
179-
robocopy %DEPS_DIR%\\%%d\\ebin _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np
180-
robocopy %DEPS_DIR%\\%%d\\include _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np
181-
)
182167
"{elixir_home}\\bin\\mix" deps.compile || goto :error
183168
"{elixir_home}\\bin\\mix" compile || goto :error
184169

0 commit comments

Comments
 (0)