Skip to content

Commit 4b16c4f

Browse files
Merge pull request #9958 from rabbitmq/mergify/bp/v3.11.x/pr-9957
Revert elixir json switch (backport #9952) (backport #9957)
2 parents 3e9167f + 165aa60 commit 4b16c4f

19 files changed

+56
-18
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ exports_files([
5353
# gazelle:exclude deps/gun
5454
# gazelle:exclude deps/inet_tcp_proxy
5555
# gazelle:exclude deps/jose
56+
# gazelle:exclude deps/json
5657
# gazelle:exclude deps/meck
5758
# gazelle:exclude deps/observer_cli
5859
# gazelle:exclude deps/osiris

MODULE.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ erlang_package.git_package(
267267
repository = "michaelklishin/erlang-jose",
268268
)
269269

270+
erlang_package.hex_package(
271+
name = "json",
272+
build_file = "@rabbitmq-server//bazel:BUILD.json",
273+
sha256 = "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16",
274+
version = "1.4.1",
275+
)
276+
270277
erlang_package.hex_package(
271278
name = "thoas",
272279
build_file = "@rabbitmq-server//bazel:BUILD.thoas",
@@ -361,6 +368,7 @@ use_repo(
361368
"getopt",
362369
"gun",
363370
"jose",
371+
"json",
364372
"observer_cli",
365373
"prometheus",
366374
"ranch",

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ XREF_EXTRA_APP_DIRS = $(filter-out deps/rabbitmq_cli/_build/dev/lib/rabbit_commo
4141
# protocols directly.
4242
XREF_IGNORE = [ \
4343
{'Elixir.CSV.Encode',impl_for,1}, \
44+
{'Elixir.JSON.Decoder',impl_for,1}, \
45+
{'Elixir.JSON.Encoder',impl_for,1}, \
4446
{'Elixir.RabbitMQ.CLI.Core.DataCoercion',impl_for,1}]
4547

4648
# Include Elixir libraries in the Xref checks.

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ mix_archive_build(
1717
archives = ["@hex//:archive"],
1818
)
1919

20+
mix_archive_build(
21+
name = "json_ez",
22+
srcs = ["@json//:sources"],
23+
out = "json.ez",
24+
archives = ["@hex//:archive"],
25+
)
26+
2027
# Note: All the various rabbitmq-* scripts are just copies of rabbitmqctl
2128
rabbitmqctl(
2229
name = "rabbitmqctl",
@@ -32,6 +39,7 @@ rabbitmqctl(
3239
license_files = glob(["LICENSE*"]),
3340
source_deps = {
3441
"@csv//:sources": "csv",
42+
"@json//:sources": "json",
3543
},
3644
visibility = ["//visibility:public"],
3745
deps = [
@@ -101,6 +109,7 @@ plt(
101109
],
102110
ez_deps = [
103111
":csv_ez",
112+
":json_ez",
104113
],
105114
ignore_warnings = True,
106115
libs = [":elixir"],
@@ -142,6 +151,7 @@ rabbitmqctl_test(
142151
source_deps = {
143152
"@amqp//:sources": "amqp",
144153
"@csv//:sources": "csv",
154+
"@json//:sources": "json",
145155
"@temp//:sources": "temp",
146156
"@x509//:sources": "x509",
147157
},

deps/rabbitmq_cli/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
PROJECT = rabbitmq_cli
22

33
BUILD_DEPS = rabbit_common
4-
DEPS = csv observer_cli stdout_formatter
4+
DEPS = csv json observer_cli stdout_formatter
55
TEST_DEPS = amqp amqp_client temp x509 rabbit
66

77
dep_amqp = hex 3.3.0
88
dep_csv = hex 3.2.0
9+
dep_json = hex 1.4.1
910
dep_temp = hex 0.4.7
1011
dep_x509 = hex 0.8.8
1112

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ExportDefinitionsCommand do
159159
end)
160160
end)
161161

162-
{:ok, json} = :rabbit_json.try_encode(map)
162+
{:ok, json} = JSON.encode(map)
163163
json
164164
end
165165

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ImportDefinitionsCommand do
166166
#
167167

168168
defp deserialise(bin, "json") do
169-
:rabbit_json.try_decode(bin)
169+
JSON.decode(bin)
170170
end
171171

172172
defp deserialise(bin, "erlang") do

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserLimitsCommand do
3636

3737
val ->
3838
Enum.map(val, fn {user, val} ->
39-
{:ok, val_encoded} = :rabbit_json.try_encode(Map.new(val))
39+
{:ok, val_encoded} = JSON.encode(Map.new(val))
4040
[user: user, limits: val_encoded]
4141
end)
4242
end
@@ -56,7 +56,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserLimitsCommand do
5656
{:badrpc, node}
5757

5858
val when is_list(val) or is_map(val) ->
59-
{:ok, val_encoded} = :rabbit_json.try_encode(Map.new(val))
59+
{:ok, val_encoded} = JSON.encode(Map.new(val))
6060
val_encoded
6161
end
6262
end

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListVhostLimitsCommand do
3636

3737
val ->
3838
Enum.map(val, fn {vhost, val} ->
39-
{:ok, val_encoded} = :rabbit_json.try_encode(Map.new(val))
39+
{:ok, val_encoded} = JSON.encode(Map.new(val))
4040
[vhost: vhost, limits: val_encoded]
4141
end)
4242
end
@@ -54,7 +54,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListVhostLimitsCommand do
5454
{:badrpc, node}
5555

5656
val when is_list(val) or is_map(val) ->
57-
:rabbit_json.try_encode(Map.new(val))
57+
JSON.encode(Map.new(val))
5858
end
5959
end
6060

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule RabbitMQ.CLI.Formatters.Json do
1818
end
1919

2020
def format_output(output, _opts) do
21-
{:ok, json} = :rabbit_json.try_encode(keys_to_atoms(output))
21+
{:ok, json} = JSON.encode(keys_to_atoms(output))
2222
json
2323
end
2424

0 commit comments

Comments
 (0)