Skip to content

Commit

Permalink
Pin rabbitmq_cli non-test deps
Browse files Browse the repository at this point in the history
- Use the same stdout_formatter copy for both erlang and rabbitmq_cli
- Use the same observer_cli copy for both erlang and rabbitmq_cli
  • Loading branch information
HoloRin committed Mar 1, 2023
1 parent 043a8d8 commit e66e5ed
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 50 deletions.
4 changes: 4 additions & 0 deletions deps/rabbitmq_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ rabbitmqctl(
visibility = ["//visibility:public"],
deps = [
"//deps/rabbit_common:erlang_app",
"@observer_cli//:erlang_app",
"@stdout_formatter//:erlang_app",
],
)

Expand Down Expand Up @@ -119,6 +121,8 @@ rabbitmqctl_test(
"//deps/amqp_client:erlang_app",
"//deps/rabbit:erlang_app",
"//deps/rabbit_common:erlang_app",
"@observer_cli//:erlang_app",
"@stdout_formatter//:erlang_app",
],
)

Expand Down
2 changes: 1 addition & 1 deletion deps/rabbitmq_cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT = rabbitmq_cli

BUILD_DEPS = rabbit_common
DEPS = observer_cli
DEPS = observer_cli stdout_formatter
TEST_DEPS = amqp_client rabbit

DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
Expand Down
90 changes: 41 additions & 49 deletions deps/rabbitmq_cli/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -123,59 +123,51 @@ defmodule RabbitMQCtl.MixfileBase do
# self-contained and RabbitMQ must be buildable offline). However, we
# don't have the equivalent for other methods.
defp deps() do
elixir_deps = [
{:json, "~> 1.4.1"},
{:csv, "~> 2.4.0"},
{:stdout_formatter, "~> 0.2.3"},
{:observer_cli, "~> 1.7.3"},
deps_dir = System.get_env("DEPS_DIR", "deps")

# Mix is confused by any `rebar.{config,lock}` we might have left in
# `rabbit_common` or `amqp_client`. So just remove those files to be
# safe, as they are generated when we publish to Hex.pm only.
for dir <- ["rabbit_common", "amqp_client"] do
for file <- ["rebar.config", "rebar.lock"] do
File.rm(Path.join([deps_dir, dir, file]))
end
end

make_cmd = System.get_env("MAKE", "make")
is_bazel = System.get_env("IS_BAZEL") != nil

[
{:json, "1.4.1"},
{:csv, "2.4.1"},
{
:stdout_formatter,
path: Path.join(deps_dir, "stdout_formatter"),
compile: if(is_bazel, do: false, else: make_cmd)
},
{
:observer_cli,
path: Path.join(deps_dir, "observer_cli"),
compile: if(is_bazel, do: false, else: make_cmd)
},
{:amqp, "~> 2.1.0", only: :test},
{:dialyxir, "~> 0.5", only: :test, runtime: false},
{:temp, "~> 0.4", only: :test},
{:x509, "~> 0.7", only: :test}
{:x509, "~> 0.7", only: :test},
{
:rabbit_common,
path: Path.join(deps_dir, "rabbit_common"),
compile: if(is_bazel, do: false, else: make_cmd),
override: true
},
{
:amqp_client,
path: Path.join(deps_dir, "amqp_client"),
compile: if(is_bazel, do: false, else: make_cmd),
override: true,
only: :test
}
]

rabbitmq_deps =
case System.get_env("DEPS_DIR") do
nil ->
# rabbitmq_cli is built as a standalone Elixir application.
[
{:rabbit_common, "~> 3.8.0"},
{:amqp_client, "~> 3.8.0", only: :test}
]

deps_dir ->
# rabbitmq_cli is built as part of RabbitMQ.

# Mix is confused by any `rebar.{config,lock}` we might have left in
# `rabbit_common` or `amqp_client`. So just remove those files to be
# safe, as they are generated when we publish to Hex.pm only.
for dir <- ["rabbit_common", "amqp_client"] do
for file <- ["rebar.config", "rebar.lock"] do
File.rm(Path.join([deps_dir, dir, file]))
end
end

make_cmd = System.get_env("MAKE", "make")
is_bazel = System.get_env("IS_BAZEL") != nil

[
{
:rabbit_common,
path: Path.join(deps_dir, "rabbit_common"),
compile: if(is_bazel, do: false, else: make_cmd),
override: true
},
{
:amqp_client,
path: Path.join(deps_dir, "amqp_client"),
compile: if(is_bazel, do: false, else: make_cmd),
override: true,
only: :test
}
]
end

elixir_deps ++ rabbitmq_deps
end

defp aliases do
Expand Down

0 comments on commit e66e5ed

Please sign in to comment.