diff options
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | src/rabbit_plugins.erl | 25 |
2 files changed, 21 insertions, 8 deletions
@@ -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). |
