Skip to content

Commit 4079b13

Browse files
committed
Use the same stdout_formatter copy for both erlang and rabbitmq_cli
1 parent 11e7dd0 commit 4079b13

File tree

4 files changed

+49
-49
lines changed

4 files changed

+49
-49
lines changed

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rabbitmqctl(
2020
visibility = ["//visibility:public"],
2121
deps = [
2222
"//deps/rabbit_common:erlang_app",
23+
"@stdout_formatter//:erlang_app",
2324
],
2425
)
2526

@@ -119,6 +120,7 @@ rabbitmqctl_test(
119120
"//deps/amqp_client:erlang_app",
120121
"//deps/rabbit:erlang_app",
121122
"//deps/rabbit_common:erlang_app",
123+
"@stdout_formatter//:erlang_app",
122124
],
123125
)
124126

deps/rabbitmq_cli/Makefile

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

33
BUILD_DEPS = rabbit_common
4-
DEPS = observer_cli
4+
DEPS = observer_cli stdout_formatter
55
TEST_DEPS = amqp_client rabbit
66

77
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk

deps/rabbitmq_cli/mix.exs

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -123,59 +123,55 @@ defmodule RabbitMQCtl.MixfileBase do
123123
# self-contained and RabbitMQ must be buildable offline). However, we
124124
# don't have the equivalent for other methods.
125125
defp deps() do
126-
elixir_deps = [
127-
{:json, "~> 1.4.1"},
128-
{:csv, "~> 2.4.0"},
129-
{:stdout_formatter, "~> 0.2.3"},
130-
{:observer_cli, "~> 1.7.3"},
126+
deps_dir = System.get_env("DEPS_DIR")
127+
128+
# Mix is confused by any `rebar.{config,lock}` we might have left in
129+
# `rabbit_common` or `amqp_client`. So just remove those files to be
130+
# safe, as they are generated when we publish to Hex.pm only.
131+
for dir <- ["rabbit_common", "amqp_client"] do
132+
for file <- ["rebar.config", "rebar.lock"] do
133+
File.rm(Path.join([deps_dir, dir, file]))
134+
end
135+
end
136+
137+
make_cmd = System.get_env("MAKE", "make")
138+
is_bazel = System.get_env("IS_BAZEL") != nil
139+
140+
[
141+
{:json, "1.4.1"},
142+
{:csv, "2.4.1"},
143+
{
144+
:stdout_formatter,
145+
path: external_dep_path("stdout_formatter"),
146+
compile: if(is_bazel, do: false, else: make_cmd),
147+
},
148+
{:observer_cli, "1.7.4"},
131149
{:amqp, "~> 2.1.0", only: :test},
132150
{:dialyxir, "~> 0.5", only: :test, runtime: false},
133151
{:temp, "~> 0.4", only: :test},
134-
{:x509, "~> 0.7", only: :test}
152+
{:x509, "~> 0.7", only: :test},
153+
{
154+
:rabbit_common,
155+
path: Path.join(deps_dir, "rabbit_common"),
156+
compile: if(is_bazel, do: false, else: make_cmd),
157+
override: true
158+
},
159+
{
160+
:amqp_client,
161+
path: Path.join(deps_dir, "amqp_client"),
162+
compile: if(is_bazel, do: false, else: make_cmd),
163+
override: true,
164+
only: :test
165+
}
135166
]
167+
end
136168

137-
rabbitmq_deps =
138-
case System.get_env("DEPS_DIR") do
139-
nil ->
140-
# rabbitmq_cli is built as a standalone Elixir application.
141-
[
142-
{:rabbit_common, "~> 3.8.0"},
143-
{:amqp_client, "~> 3.8.0", only: :test}
144-
]
145-
146-
deps_dir ->
147-
# rabbitmq_cli is built as part of RabbitMQ.
148-
149-
# Mix is confused by any `rebar.{config,lock}` we might have left in
150-
# `rabbit_common` or `amqp_client`. So just remove those files to be
151-
# safe, as they are generated when we publish to Hex.pm only.
152-
for dir <- ["rabbit_common", "amqp_client"] do
153-
for file <- ["rebar.config", "rebar.lock"] do
154-
File.rm(Path.join([deps_dir, dir, file]))
155-
end
156-
end
157-
158-
make_cmd = System.get_env("MAKE", "make")
159-
is_bazel = System.get_env("IS_BAZEL") != nil
160-
161-
[
162-
{
163-
:rabbit_common,
164-
path: Path.join(deps_dir, "rabbit_common"),
165-
compile: if(is_bazel, do: false, else: make_cmd),
166-
override: true
167-
},
168-
{
169-
:amqp_client,
170-
path: Path.join(deps_dir, "amqp_client"),
171-
compile: if(is_bazel, do: false, else: make_cmd),
172-
override: true,
173-
only: :test
174-
}
175-
]
176-
end
177-
178-
elixir_deps ++ rabbitmq_deps
169+
defp external_dep_path(name) do
170+
if System.get_env("IS_BAZEL") != nil do
171+
Path.wildcard(Path.join(System.get_env("ABS_EXTERNAL_DEPS"), "rules_erlang~*~erlang_package~" <> name))
172+
else
173+
Path.join(System.get_env("DEPS_DIR"), "stdout_formatter")
174+
end
179175
end
180176

181177
defp aliases do

deps/rabbitmq_cli/rabbitmqctl.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export PATH="$ABS_ELIXIR_HOME"/bin:"{erlang_home}"/bin:${{PATH}}
9292
export LANG="en_US.UTF-8"
9393
export LC_ALL="en_US.UTF-8"
9494
95+
export ABS_EXTERNAL_DEPS=$PWD/external
96+
9597
MIX_INVOCATION_DIR="{mix_invocation_dir}"
9698
9799
cp -r {package_dir}/config ${{MIX_INVOCATION_DIR}}/config

0 commit comments

Comments
 (0)