summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@rabbitmq.com>2016-12-20 17:22:12 +0000
committerJean-Sébastien Pedron <jean-sebastien@rabbitmq.com>2016-12-20 17:22:12 +0000
commitcbbcc3e32f97b6047b4f82f0776717dd3e85430c (patch)
treee200bdda2a3cd9a6a07ae7b5c2a9f12a99a7161c
parentbc1011d0ea93591bb01faf105a58d05cdc1bea76 (diff)
downloadrabbitmq-server-git-cbbcc3e32f97b6047b4f82f0776717dd3e85430c.tar.gz
Ignore indirect dependencies of rabbit in rabbit_plugins
The goal of maybe_keep_required_deps() is still the same: we don't want to list applications from $RABBITMQ_PLUGINS_DIR the rabbit application depends on. Now, the function handles indirect dependencies. Signed-off-by: Jean-Sébastien Pedron <jean-sebastien@rabbitmq.com> [#136346167]
-rw-r--r--Makefile4
-rw-r--r--src/rabbit_plugins.erl25
2 files changed, 21 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 3c11b54020..f87a09ec7a 100644
--- a/Makefile
+++ b/Makefile
@@ -116,9 +116,7 @@ define PROJECT_ENV
]
endef
-# FIXME: Remove goldrush, once rabbit_plugins.erl knows how to ignore
-# indirect dependencies of rabbit.
-LOCAL_DEPS = sasl mnesia os_mon xmerl goldrush jsx
+LOCAL_DEPS = sasl mnesia os_mon
BUILD_DEPS = rabbitmq_cli
DEPS = ranch lager rabbit_common
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index 40dbf91cfd..171448b05c 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -608,11 +608,7 @@ remove_duplicate_plugins([Plugin|Rest], {Plugins0, Problems0}) ->
maybe_keep_required_deps(true, Plugins) ->
Plugins;
maybe_keep_required_deps(false, Plugins) ->
- %% We load the "rabbit" application to be sure we can get the
- %% "applications" key. This is required for rabbitmq-plugins for
- %% instance.
- application:load(rabbit),
- {ok, RabbitDeps} = application:get_key(rabbit, applications),
+ RabbitDeps = list_all_deps([rabbit]),
lists:filter(fun
(#plugin{name = Name}) ->
not lists:member(Name, RabbitDeps);
@@ -621,6 +617,25 @@ maybe_keep_required_deps(false, Plugins) ->
end,
Plugins).
+list_all_deps(Applications) ->
+ list_all_deps(Applications, []).
+
+list_all_deps([Application | Applications], Deps) ->
+ %% We load the application to be sure we can get the "applications" key.
+ %% This is required for rabbitmq-plugins for instance.
+ application:load(Application),
+ NewDeps = [Application | Deps],
+ case application:get_key(Application, applications) of
+ {ok, ApplicationDeps} ->
+ RemainingApplications0 = ApplicationDeps ++ Applications,
+ RemainingApplications = RemainingApplications0 -- NewDeps,
+ list_all_deps(RemainingApplications, NewDeps);
+ undefined ->
+ list_all_deps(Applications, NewDeps)
+ end;
+list_all_deps([], Deps) ->
+ Deps.
+
remove_otp_overrideable_plugins(Plugins) ->
lists:filter(fun(P) -> not plugin_provided_by_otp(P) end,
Plugins).