Merge pull request #11549 from rabbitmq/loic-make-cleanups

Various make cleanup/consolidation
This commit is contained in:
Loïc Hoguin 2024-06-27 11:42:24 +02:00 committed by GitHub
commit 18f8ee1457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
54 changed files with 25 additions and 776 deletions

View File

@ -134,10 +134,7 @@ plt(
PLUGINS = all_plugins(
rabbitmq_workspace = "",
) + select({
"@rules_erlang//:debug_build": ["@looking_glass//:erlang_app"],
"//conditions:default": [],
})
)
rabbitmq_home(
name = "broker-home",
@ -286,7 +283,6 @@ moduleindex(
"@ct_helper//:erlang_app",
"@emqtt//:erlang_app",
"@inet_tcp_proxy_dist//:erlang_app",
"@looking_glass//:erlang_app",
"@meck//:erlang_app",
"@proper//:erlang_app",
"//deps/rabbitmq_ct_client_helpers:erlang_app",

View File

@ -54,13 +54,6 @@ bazel_dep(
version = "1.1.0",
)
bazel_dep(
name = "com_github_rabbitmq_looking_glass",
version = "0.2.2",
dev_dependency = True,
repo_name = "looking_glass",
)
bazel_dep(
name = "rabbitmq_osiris",
version = "1.8.2",

View File

@ -14,11 +14,11 @@ PACKAGES_DIR ?= $(abspath PACKAGES)
include plugins.mk
# An additional list of plugins to include in a RabbitMQ release,
# on top of the standard plugins. For example, looking_glass.
# on top of the standard plugins.
#
# Note: When including NIFs in a release make sure to build
# them on the appropriate platform for the target environment.
# For example build looking_glass on Linux when targeting Docker.
# For example build on Linux when targeting Docker.
ADDITIONAL_PLUGINS ?=
DEPS = rabbit_common rabbit $(PLUGINS) $(ADDITIONAL_PLUGINS)
@ -66,6 +66,13 @@ include mk/github-actions.mk
include mk/bazel.mk
include mk/topic-branches.mk
# If PLUGINS was set when we use run-broker we want to
# fill in the enabled plugins list. PLUGINS is a more
# natural space-separated list.
ifdef PLUGINS
RABBITMQ_ENABLED_PLUGINS ?= $(call comma_list,$(PLUGINS))
endif
# --------------------------------------------------------------------
# Mix Hex cache management.
# --------------------------------------------------------------------
@ -145,7 +152,6 @@ RSYNC_FLAGS += -a $(RSYNC_V) \
--exclude '*.pyc' \
--exclude '.git*' \
--exclude '.hg*' \
--exclude '.travis.yml*' \
--exclude '.*.plt' \
--exclude '*.bzl' \
--exclude '*.bazel' \
@ -176,7 +182,6 @@ RSYNC_FLAGS += -a $(RSYNC_V) \
--include 'cli/plugins' \
--exclude '$(notdir $(DIST_DIR))/' \
--exclude 'test' \
--exclude 'xrefr' \
--exclude '/$(notdir $(PACKAGES_DIR))/' \
--exclude '/PACKAGES/' \
--exclude '/amqp_client/doc/' \

View File

@ -14,7 +14,6 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
elvis
amqp10_client.d

View File

@ -34,8 +34,7 @@ TEST_DEPS = rabbit rabbitmq_ct_helpers
LOCAL_DEPS = ssl inets crypto public_key
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
DEP_PLUGINS = rabbit_common/mk/rabbitmq-macros.mk \
rabbit_common/mk/rabbitmq-build.mk \
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
rabbit_common/mk/rabbitmq-hexpm.mk \
rabbit_common/mk/rabbitmq-dist.mk \
rabbit_common/mk/rabbitmq-run.mk \

View File

@ -18,7 +18,6 @@
/sbin/
/sbin.lock
/test/ct.cover.spec
/xrefr
_build
/amqp10_common.d

View File

@ -18,5 +18,4 @@
/rebar.lock
/sbin
/test/ct.cover.spec
/xrefr
/amqp_client.d

View File

@ -14,7 +14,6 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
elvis
/*.coverdata

View File

@ -10,8 +10,7 @@ LOCAL_DEPS = ssl inets crypto public_key
PLT_APPS = rabbit
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
DEP_PLUGINS = rabbit_common/mk/rabbitmq-macros.mk \
rabbit_common/mk/rabbitmq-build.mk \
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
rabbit_common/mk/rabbitmq-hexpm.mk \
rabbit_common/mk/rabbitmq-dist.mk \
rabbit_common/mk/rabbitmq-run.mk \

View File

@ -19,7 +19,6 @@ MnesiaCore.*
/plugins.lock
/test/ct.cover.spec
/test/config_schema_SUITE_data/schema/**
/xrefr
/sbin/
/sbin.lock
rabbit.d

View File

@ -186,8 +186,6 @@ test_suite_beam_files(name = "test_suite_beam_files")
# gazelle:erlang_app_dep sysmon_handler
# gazelle:erlang_app_dep systemd
# gazelle:erlang_app_dep_exclude looking_glass
rabbitmq_app(
name = "erlang_app",
srcs = [":all_srcs"],
@ -253,7 +251,6 @@ plt(
plt = "//:base_plt",
deps = [
"//deps/rabbitmq_cli:erlang_app", # keep
"@looking_glass//:erlang_app", # keep
],
)

View File

@ -132,11 +132,11 @@ endef
LOCAL_DEPS = sasl os_mon inets compiler public_key crypto ssl syntax_tools xmerl
BUILD_DEPS = rabbitmq_cli looking_glass
BUILD_DEPS = rabbitmq_cli
DEPS = ranch rabbit_common amqp10_common rabbitmq_prelaunch ra sysmon_handler stdout_formatter recon redbug observer_cli osiris syslog systemd seshat khepri khepri_mnesia_migration cuttlefish gen_batch_server
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers meck proper amqp_client rabbitmq_amqp_client rabbitmq_amqp1_0
PLT_APPS += mnesia runtime_tools looking_glass
PLT_APPS += mnesia runtime_tools
dep_syslog = git https://github.com/schlagert/syslog 4.0.0
dep_osiris = git https://github.com/rabbitmq/osiris v1.8.2

3
deps/rabbit/app.bzl vendored
View File

@ -162,7 +162,6 @@ def all_beam_files(name = "all_beam_files"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_message_interceptor.erl",
"src/rabbit_metrics.erl",
@ -421,7 +420,6 @@ def all_test_beam_files(name = "all_test_beam_files"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_message_interceptor.erl",
"src/rabbit_metrics.erl",
@ -699,7 +697,6 @@ def all_srcs(name = "all_srcs"):
"src/rabbit_log_queue.erl",
"src/rabbit_log_tail.erl",
"src/rabbit_logger_exchange_h.erl",
"src/rabbit_looking_glass.erl",
"src/rabbit_maintenance.erl",
"src/rabbit_message_interceptor.erl",
"src/rabbit_metrics.erl",

View File

@ -222,12 +222,6 @@
{requires, [core_initialized, recovery]},
{enables, routing_ready}]}).
-rabbit_boot_step({rabbit_looking_glass,
[{description, "Looking Glass tracer and profiler"},
{mfa, {rabbit_looking_glass, boot, []}},
{requires, [core_initialized, recovery]},
{enables, routing_ready}]}).
-rabbit_boot_step({rabbit_observer_cli,
[{description, "Observer CLI configuration"},
{mfa, {rabbit_observer_cli, init, []}},

View File

@ -1,102 +0,0 @@
%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term Broadcom refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%
-module(rabbit_looking_glass).
-ignore_xref([
{lg, trace, 4},
{lg, stop, 0},
{lg_callgrind, profile_many, 3}
]).
-ignore_xref([{maps, from_list, 1}]).
-export([boot/0]).
-export([trace/1, trace_qq/0, profile/0, profile/1]).
-export([connections/0]).
boot() ->
case os:getenv("RABBITMQ_TRACER") of
false ->
ok;
On when On =:= "1" orelse On =:= "true" ->
rabbit_log:info("Loading Looking Glass profiler for interactive use"),
case application:ensure_all_started(looking_glass) of
{ok, _} -> ok;
{error, Error} ->
rabbit_log:error("Failed to start Looking Glass, reason: ~tp", [Error])
end;
Value ->
Input = parse_value(Value),
rabbit_log:info(
"Enabling Looking Glass profiler, input value: ~tp",
[Input]
),
{ok, _} = application:ensure_all_started(looking_glass),
lg:trace(
Input,
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile},
{process_dump, true},
{running, true},
{send, true}]
)
)
end.
trace(Input) ->
lg:trace(Input,
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile},
{process_dump, true},
{running, true},
{send, true}]
)).
trace_qq() ->
dbg:stop(),
lg:trace([ra_server,
ra_server_proc,
rabbit_fifo,
queue,
rabbit_fifo_index
],
lg_file_tracer,
"traces.lz4",
maps:from_list([
{mode, profile}
% {process_dump, true},
% {running, true},
% {send, true}
]
)),
timer:sleep(10000),
_ = lg:stop(),
profile().
profile() ->
profile("callgrind.out").
profile(Filename) ->
lg_callgrind:profile_many("traces.lz4.*", Filename, #{running => true}).
%%
%% Implementation
%%
parse_value(Value) ->
[begin
[Mod, Fun] = string:tokens(C, ":"),
{callback, list_to_atom(Mod), list_to_atom(Fun)}
end || C <- string:tokens(Value, ",")].
connections() ->
Pids = [Pid || {{conns_sup, _}, Pid} <- ets:tab2list(ranch_server)],
['_', {scope, Pids}].

View File

@ -21,6 +21,5 @@
/sbin/
/sbin.lock
/test/ct.cover.spec
/xrefr
/rabbit_common.d

View File

@ -56,7 +56,6 @@ HEX_TARBALL_FILES += rabbitmq-components.mk \
mk/rabbitmq-dist.mk \
mk/rabbitmq-early-test.mk \
mk/rabbitmq-hexpm.mk \
mk/rabbitmq-macros.mk \
mk/rabbitmq-test.mk \
mk/rabbitmq-tools.mk

View File

@ -2,10 +2,6 @@
# Compiler flags.
# --------------------------------------------------------------------
ifeq ($(filter rabbitmq-macros.mk,$(notdir $(MAKEFILE_LIST))),)
include $(dir $(lastword $(MAKEFILE_LIST)))rabbitmq-macros.mk
endif
# NOTE: This plugin is loaded twice because Erlang.mk recurses. That's
# why ERL_LIBS may contain twice the path to Elixir libraries or
# ERLC_OPTS may contain duplicated flags.

View File

@ -134,14 +134,10 @@ ZIP_V = $(ZIP_V_$(V))
$(ERLANGMK_DIST_EZS):
$(verbose) rm -rf $(EZ_DIR) $(EZ)
$(verbose) mkdir -p $(EZ_DIR)
$(dist_verbose) $(RSYNC) -a $(RSYNC_V) \
--exclude '/ebin/dep_built' \
--exclude '/ebin/test' \
--include '/ebin/***' \
--include '/include/***' \
--include '/priv/***' \
--exclude '*' \
$(call core_unix_path,$(SRC_DIR))/ $(call core_unix_path,$(EZ_DIR))/
$(eval SRC_DIR_UNIX := $(call core_unix_path,$(SRC_DIR)))
$(eval EZ_DIR_UNIX := $(call core_unix_path,$(EZ_DIR)))
$(dist_verbose) cp -a $(SRC_DIR_UNIX)/ebin $(wildcard $(SRC_DIR_UNIX)/include) $(wildcard $(SRC_DIR_UNIX)/priv) $(EZ_DIR_UNIX)/
$(verbose) rm -f $(EZ_DIR_UNIX)/ebin/dep_built $(EZ_DIR_UNIX)/ebin/test
@# Give a chance to the application to make any modification it
@# wants to the tree before we make an archive.
ifneq ($(RABBITMQ_COMPONENTS),)

View File

@ -1,15 +1,3 @@
# --------------------------------------------------------------------
# xref
# --------------------------------------------------------------------
ifeq ($(filter distclean distclean-xref,$(MAKECMDGOALS)),)
ifneq ($(PROJECT),rabbit_common)
XREFR := $(DEPS_DIR)/rabbit_common/mk/xrefr
else
XREFR := mk/xrefr
endif
endif
# --------------------------------------------------------------------
# dialyzer
# --------------------------------------------------------------------
@ -41,7 +29,7 @@ endif
CT_OPTS += -hidden
# Enable the following common_test hooks on Travis and Concourse:
# Enable the following common_test hooks on GH and Concourse:
#
# cth_fail_fast
# This hook will make sure the first failure puts an end to the
@ -56,15 +44,8 @@ CT_OPTS += -hidden
# from its UI. Furthermore, it displays a graph showing evolution of the
# results over time.
ifndef TRAVIS
CT_HOOKS ?= cth_styledout
TEST_DEPS += cth_styledout
endif
ifdef TRAVIS
FAIL_FAST = 1
SKIP_AS_ERROR = 1
endif
ifdef CONCOURSE
FAIL_FAST = 1
@ -83,49 +64,9 @@ dep_cth_styledout = git https://github.com/rabbitmq/cth_styledout.git master
CT_HOOKS_PARAM_VALUE = $(patsubst %,and %,$(CT_HOOKS))
CT_OPTS += -ct_hooks $(wordlist 2,$(words $(CT_HOOKS_PARAM_VALUE)),$(CT_HOOKS_PARAM_VALUE))
# Disable most messages on Travis because it might exceed the limit
# set by Travis.
#
# CAUTION: All arguments after -erl_args are passed to the emulator and
# common_test doesn't interpret them! Therefore, all common_test flags
# *MUST* appear before.
CT_QUIET_FLAGS = -verbosity 50 \
-erl_args \
-kernel error_logger silent
ifdef TRAVIS
CT_OPTS += $(CT_QUIET_FLAGS)
endif
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
# testsuite/testgroup/testcase is considered an error.
ifeq ($(SKIP_AS_ERROR),1)
export RABBITMQ_CT_SKIP_AS_ERROR = true
endif
# --------------------------------------------------------------------
# Looking Glass rules.
# --------------------------------------------------------------------
ifneq ("$(RABBITMQ_TRACER)","")
BUILD_DEPS += looking_glass
ERL_LIBS := "$(ERL_LIBS):../looking_glass:../lz4"
export RABBITMQ_TRACER
endif
define lg_callgrind.erl
lg_callgrind:profile_many("traces.lz4.*", "callgrind.out", #{running => true}),
halt().
endef
.PHONY: profile clean-profile
profile:
$(gen_verbose) $(call erlang,$(call lg_callgrind.erl))
clean:: clean-profile
clean-profile:
$(gen_verbose) rm -f traces.lz4.* callgrind.out.*

View File

@ -1,22 +0,0 @@
# Macro to compare two x.y.z versions.
#
# Usage:
# ifeq ($(call compare_version,$(ERTS_VER),$(MAX_ERTS_VER),<),true)
# # Only evaluated if $(ERTS_VER) < $(MAX_ERTS_VER)
# endif
define compare_version
$(shell awk 'BEGIN {
split("$(1)", v1, ".");
version1 = v1[1] * 1000000 + v1[2] * 10000 + v1[3] * 100 + v1[4];
split("$(2)", v2, ".");
version2 = v2[1] * 1000000 + v2[2] * 10000 + v2[3] * 100 + v2[4];
if (version1 $(3) version2) {
print "true";
} else {
print "false";
}
}')
endef

View File

@ -44,18 +44,6 @@ CODEGEN_DIR = $(DEPS_DIR)/rabbitmq_codegen
PYTHONPATH = $(CODEGEN_DIR)
export PYTHONPATH
ANT ?= ant
ANT_FLAGS += -Dmake.bin=$(MAKE) \
-DUMBRELLA_AVAILABLE=true \
-Drabbitmqctl.bin=$(RABBITMQCTL) \
-Dsibling.codegen.dir=$(CODEGEN_DIR)
ifeq ($(PROJECT),rabbitmq_test)
ANT_FLAGS += -Dsibling.rabbitmq_test.dir=$(CURDIR)
else
ANT_FLAGS += -Dsibling.rabbitmq_test.dir=$(DEPS_DIR)/rabbitmq_test
endif
export ANT ANT_FLAGS
node_tmpdir = $(TEST_TMPDIR)/$(1)
node_pid_file = $(call node_tmpdir,$(1))/$(1).pid
node_log_base = $(call node_tmpdir,$(1))/log
@ -98,13 +86,6 @@ RABBITMQ_ENABLED_PLUGINS_FILE ?= $(call node_enabled_plugins_file,$(RABBITMQ_NOD
RABBITMQ_LOG ?= debug,+color
export RABBITMQ_LOG
FAST_RUN_BROKER ?= 1
ifeq ($(FAST_RUN_BROKER),1)
DIST_TARGET = $(if $(NOBUILD),,all)
PLUGINS_FROM_DEPS_DIR = 1
endif
ifdef PLUGINS_FROM_DEPS_DIR
RMQ_PLUGINS_DIR = $(DEPS_DIR)
DIST_ERL_LIBS = $(ERL_LIBS)
@ -165,15 +146,8 @@ virgin-node-tmpdir:
ifdef LEAVE_PLUGINS_DISABLED
RABBITMQ_ENABLED_PLUGINS ?=
else
# When running "make -C deps/plugin run-broker" we only want
# "plugin" to be enabled. See rabbitmq-components.mk for where
# this variable comes from.
ifdef deps_dir_overriden
RABBITMQ_ENABLED_PLUGINS ?= $(filter-out rabbit,$(PROJECT))
else
RABBITMQ_ENABLED_PLUGINS ?= ALL
endif
endif
# --------------------------------------------------------------------
# Run a full RabbitMQ.

View File

@ -3,20 +3,6 @@
ct-slow ct-fast:
$(MAKE) ct CT_SUITES='$(CT_SUITES)'
# --------------------------------------------------------------------
# xref
# --------------------------------------------------------------------
# We need the list of dependencies of the current project. We use it in
# xrefr(1) to scan for Elixir-based projects. For those, we need to add
# the path inside `_build` to the xref code path.
ifneq ($(filter xref,$(MAKECMDGOALS)),)
export ERLANG_MK_RECURSIVE_DEPS_LIST
endif
xref: $(ERLANG_MK_RECURSIVE_DEPS_LIST)
# --------------------------------------------------------------------
# Helpers to run Make targets on Concourse.
# --------------------------------------------------------------------

View File

@ -35,78 +35,6 @@ update-contributor-code-of-conduct:
cp $(DEPS_DIR)/rabbit_common/CONTRIBUTING.md $$repo/CONTRIBUTING.md; \
done
ifdef CREDS
define replace_aws_creds
set -e; \
if test -f "$(CREDS)"; then \
key_id=$(shell travis encrypt --no-interactive \
"AWS_ACCESS_KEY_ID=$$(awk '/^rabbitmq-s3-access-key-id/ { print $$2; }' < "$(CREDS)")"); \
access_key=$(shell travis encrypt --no-interactive \
"AWS_SECRET_ACCESS_KEY=$$(awk '/^rabbitmq-s3-secret-access-key/ { print $$2; }' < "$(CREDS)")"); \
mv .travis.yml .travis.yml.orig; \
awk "\
/^ global:/ { \
print; \
print \" - secure: $$key_id\"; \
print \" - secure: $$access_key\"; \
next; \
} \
/- secure:/ { next; } \
{ print; }" < .travis.yml.orig > .travis.yml; \
rm -f .travis.yml.orig; \
else \
echo " INFO: CREDS file missing; not setting/updating AWS credentials"; \
fi
endef
else
define replace_aws_creds
echo " INFO: CREDS not set; not setting/updating AWS credentials"
endef
endif
ifeq ($(PROJECT),rabbit_common)
travis-yml:
$(gen_verbose) $(replace_aws_creds)
else
travis-yml:
$(gen_verbose) \
set -e; \
if test -d .git && test -d $(DEPS_DIR)/rabbit_common/.git; then \
upstream_branch=$$(LANG=C git -C $(DEPS_DIR)/rabbit_common branch --list | awk '/^\* \(.*detached / {ref=$$0; sub(/.*detached [^ ]+ /, "", ref); sub(/\)$$/, "", ref); print ref; exit;} /^\* / {ref=$$0; sub(/^\* /, "", ref); print ref; exit}'); \
local_branch=$$(LANG=C git branch --list | awk '/^\* \(.*detached / {ref=$$0; sub(/.*detached [^ ]+ /, "", ref); sub(/\)$$/, "", ref); print ref; exit;} /^\* / {ref=$$0; sub(/^\* /, "", ref); print ref; exit}'); \
test "$$local_branch" = "$$upstream_branch" || exit 0; \
fi; \
test -f .travis.yml || exit 0; \
(grep -E -- '- secure:' .travis.yml || :) > .travis.yml.creds; \
cp -a $(DEPS_DIR)/rabbit_common/.travis.yml .travis.yml.orig; \
awk ' \
/^ global:/ { \
print; \
system("test -f .travis.yml.creds && cat .travis.yml.creds"); \
next; \
} \
/- secure:/ { next; } \
{ print; } \
' < .travis.yml.orig > .travis.yml; \
rm -f .travis.yml.orig .travis.yml.creds; \
if test -f .travis.yml.patch; then \
patch -p0 < .travis.yml.patch; \
rm -f .travis.yml.orig; \
fi; \
$(replace_aws_creds)
ifeq ($(DO_COMMIT),yes)
$(verbose) ! test -f .travis.yml || \
git diff --quiet .travis.yml \
|| git commit -m 'Travis CI: Update config from rabbitmq-common' .travis.yml
endif
endif
update-travis-yml: travis-yml
$(verbose) for repo in $(READY_DEPS:%=$(DEPS_DIR)/%); do \
! test -f $$repo/rabbitmq-components.mk \
|| $(MAKE) -C $$repo travis-yml; \
done
ifneq ($(wildcard .git),)
.PHONY: sync-gitremote sync-gituser

View File

@ -1,338 +0,0 @@
#!/usr/bin/env escript
%% vim:ft=erlang:
%% The code is copied from xref_runner.
%% https://github.com/inaka/xref_runner
%%
%% The only change is the support of our erlang_version_support
%% attribute: we don't want any warnings about functions which will be
%% dropped at load time.
%%
%% It's also a plain text escript instead of a compiled one because we
%% want to support Erlang R16B03 and the version of xref_runner uses
%% maps and is built with something like Erlang 18.
%% This mode allows us to reference local function. For instance:
%% lists:map(fun generate_comment/1, Comments)
-mode(compile).
-define(DIRS, ["ebin", "test"]).
-define(CHECKS, [undefined_function_calls,
undefined_functions,
locals_not_used]).
main(_) ->
Checks = ?CHECKS,
ElixirDeps = get_elixir_deps_paths(),
[true = code:add_path(P) || P <- ElixirDeps],
XrefWarnings = lists:append([check(Check) || Check <- Checks]),
warnings_prn(XrefWarnings),
case XrefWarnings of
[] -> ok;
_ -> halt(1)
end.
get_elixir_deps_paths() ->
case os:getenv("ERLANG_MK_RECURSIVE_DEPS_LIST") of
false ->
[];
Filename ->
{ok, Fd} = file:open(Filename, [read]),
get_elixir_deps_paths1(Fd, [])
end.
get_elixir_deps_paths1(Fd, Paths) ->
case file:read_line(Fd) of
{ok, Line0} ->
Line = Line0 -- [$\r, $\n],
RootPath = case os:type() of
{unix, _} ->
Line;
{win32, _} ->
case os:find_executable("cygpath.exe") of
false ->
Line;
Cygpath ->
os:cmd(
io_lib:format("~s --windows \"~s\"",
[Cygpath, Line]))
-- [$\r, $\n]
end
end,
Glob = filename:join([RootPath, "_build", "dev", "lib", "*", "ebin"]),
NewPaths = filelib:wildcard(Glob),
get_elixir_deps_paths1(Fd, Paths ++ NewPaths);
eof ->
add_elixir_stdlib_path(Paths)
end.
add_elixir_stdlib_path(Paths) ->
case find_elixir_home() of
false -> Paths;
ElixirLibDir -> [ElixirLibDir | Paths]
end.
find_elixir_home() ->
ElixirExe = case os:type() of
{unix, _} -> "elixir";
{win32, _} -> "elixir.bat"
end,
case os:find_executable(ElixirExe) of
false -> false;
ExePath -> resolve_symlink(ExePath)
end.
resolve_symlink(ExePath) ->
case file:read_link_all(ExePath) of
{error, einval} ->
determine_elixir_home(ExePath);
{ok, ResolvedLink} ->
ExePath1 = filename:absname(ResolvedLink,
filename:dirname(ExePath)),
resolve_symlink(ExePath1);
{error, _} ->
false
end.
determine_elixir_home(ExePath) ->
LibPath = filename:join([filename:dirname(filename:dirname(ExePath)),
"lib",
"elixir",
"ebin"]),
case filelib:is_dir(LibPath) of
true -> LibPath;
false -> {skip, "Failed to locate Elixir lib dir"}
end.
check(Check) ->
Dirs = ?DIRS,
lists:foreach(fun code:add_path/1, Dirs),
{ok, Xref} = xref:start([]),
try
ok = xref:set_library_path(Xref, code:get_path()),
lists:foreach(
fun(Dir) ->
case filelib:is_dir(Dir) of
true -> {ok, _} = xref:add_directory(Xref, Dir);
false -> ok
end
end, Dirs),
{ok, Results} = xref:analyze(Xref, Check),
FilteredResults = filter_xref_results(Check, Results),
[result_to_warning(Check, Result) || Result <- FilteredResults]
after
stopped = xref:stop(Xref)
end.
%% -------------------------------------------------------------------
%% Filtering results.
%% -------------------------------------------------------------------
filter_xref_results(Check, Results) ->
SourceModules =
lists:usort([source_module(Result) || Result <- Results]),
Ignores = lists:flatmap(
fun(Module) -> get_ignorelist(Module, Check) end, SourceModules),
UnusedFunctions = lists:flatmap(
fun(Mod) -> get_unused_compat_functions(Mod) end,
SourceModules),
ToIgnore = case get(results_to_ignore) of
undefined -> [];
RTI -> RTI
end,
NewToIgnore = [parse_xref_target(Result)
|| Result <- Results,
lists:member(parse_xref_source(Result), UnusedFunctions)],
AllToIgnore = ToIgnore ++ NewToIgnore ++ [mfa(M, {F, A})
|| {_, {M, F, A}} <- Ignores],
put(results_to_ignore, AllToIgnore),
[Result || Result <- Results,
not lists:member(parse_xref_result(Result), Ignores) andalso
not lists:member(parse_xref_result(Result), AllToIgnore) andalso
not lists:member(parse_xref_source(Result), UnusedFunctions)].
source_module({Mt, _Ft, _At}) -> Mt;
source_module({{Ms, _Fs, _As}, _Target}) -> Ms.
%%
%% Ignore behaviour functions, and explicitly marked functions
%%
%% Functions can be ignored by using
%% -ignore_xref([{F, A}, {M, F, A}...]).
get_ignorelist(Mod, Check) ->
%% Get ignore_xref attribute and combine them in one list
Attributes =
try
Mod:module_info(attributes)
catch
_Class:_Error -> []
end,
IgnoreXref =
[mfa(Mod, Value) || {ignore_xref, Values} <- Attributes, Value <- Values],
BehaviourCallbacks = get_behaviour_callbacks(Check, Mod, Attributes),
%% And create a flat {M, F, A} list
IgnoreXref ++ BehaviourCallbacks.
get_behaviour_callbacks(exports_not_used, Mod, Attributes) ->
Behaviours = [Value || {behaviour, Values} <- Attributes, Value <- Values],
[{Mod, {Mod, F, A}}
|| B <- Behaviours, {F, A} <- B:behaviour_info(callbacks)];
get_behaviour_callbacks(_Check, _Mod, _Attributes) ->
[].
get_unused_compat_functions(Module) ->
OTPVersion = code_version:get_otp_version(),
Attributes = try
Module:module_info(attributes)
catch
_Class:_Error -> []
end,
CompatTuples = [Tuple
|| {erlang_version_support, Tuples} <- Attributes,
Tuple <- Tuples],
get_unused_compat_functions(Module, OTPVersion, CompatTuples, []).
get_unused_compat_functions(_, _, [], Result) ->
Result;
get_unused_compat_functions(Module,
OTPVersion,
[{MinOTPVersion, Choices} | Rest],
Result) ->
Functions = lists:map(
fun({_, Arity, Pre, Post}) ->
if
OTPVersion >= MinOTPVersion ->
%% We ignore the "pre" function.
mfa(Module, {Pre, Arity});
true ->
%% We ignore the "post" function.
mfa(Module, {Post, Arity})
end
end, Choices),
get_unused_compat_functions(Module, OTPVersion, Rest,
Result ++ Functions).
mfa(M, {F, A}) -> {M, {M, F, A}};
mfa(M, MFA) -> {M, MFA}.
parse_xref_result({{SM, _, _}, MFAt}) -> {SM, MFAt};
parse_xref_result({TM, _, _} = MFAt) -> {TM, MFAt}.
parse_xref_source({{SM, _, _} = MFAt, _}) -> {SM, MFAt};
parse_xref_source({TM, _, _} = MFAt) -> {TM, MFAt}.
parse_xref_target({_, {TM, _, _} = MFAt}) -> {TM, MFAt};
parse_xref_target({TM, _, _} = MFAt) -> {TM, MFAt}.
%% -------------------------------------------------------------------
%% Preparing results.
%% -------------------------------------------------------------------
result_to_warning(Check, {MFASource, MFATarget}) ->
{Filename, Line} = get_source(MFASource),
[{filename, Filename},
{line, Line},
{source, MFASource},
{target, MFATarget},
{check, Check}];
result_to_warning(Check, MFA) ->
{Filename, Line} = get_source(MFA),
[{filename, Filename},
{line, Line},
{source, MFA},
{check, Check}].
%%
%% Given a MFA, find the file and LOC where it's defined. Note that
%% xref doesn't work if there is no abstract_code, so we can avoid
%% being too paranoid here.
%%
get_source({M, F, A}) ->
case code:get_object_code(M) of
error -> {"", 0};
{M, Bin, _} -> find_function_source(M, F, A, Bin)
end.
find_function_source(M, F, A, Bin) ->
AbstractCode = beam_lib:chunks(Bin, [abstract_code]),
{ok, {M, [{abstract_code, {raw_abstract_v1, Code}}]}} = AbstractCode,
%% Extract the original source filename from the abstract code
[Source|_] = [S || {attribute, _, file, {S, _}} <- Code],
%% Extract the line number for a given function def
Fn = [E || E <- Code,
element(1, E) == function,
element(3, E) == F,
element(4, E) == A],
case Fn of
[{function, Line, F, _, _}] when is_integer(Line) ->
{Source, Line};
[{function, Line, F, _, _}] ->
{Source, erl_anno:line(Line)};
%% do not crash if functions are exported, even though they
%% are not in the source.
%% parameterized modules add new/1 and instance/1 for example.
[] -> {Source, 0}
end.
%% -------------------------------------------------------------------
%% Reporting results.
%% -------------------------------------------------------------------
warnings_prn([]) ->
ok;
warnings_prn(Comments) ->
Messages = lists:map(fun generate_comment/1, Comments),
lists:foreach(fun warning_prn/1, Messages).
warning_prn(Message) ->
FullMessage = Message ++ "~n",
io:format(FullMessage, []).
generate_comment(XrefWarning) ->
Filename = proplists:get_value(filename, XrefWarning),
Line = proplists:get_value(line, XrefWarning),
Source = proplists:get_value(source, XrefWarning),
Check = proplists:get_value(check, XrefWarning),
Target = proplists:get_value(target, XrefWarning),
Position = case {Filename, Line} of
{"", _} -> "";
{Filename, 0} -> [Filename, " "];
{Filename, Line} -> [Filename, ":",
integer_to_list(Line), " "]
end,
[Position, generate_comment_text(Check, Source, Target)].
generate_comment_text(Check, {SM, SF, SA}, TMFA) ->
SMFA = io_lib:format("`~p:~p/~p`", [SM, SF, SA]),
generate_comment_text(Check, SMFA, TMFA);
generate_comment_text(Check, SMFA, {TM, TF, TA}) ->
TMFA = io_lib:format("`~p:~p/~p`", [TM, TF, TA]),
generate_comment_text(Check, SMFA, TMFA);
generate_comment_text(undefined_function_calls, SMFA, TMFA) ->
io_lib:format("~s calls undefined function ~s", [SMFA, TMFA]);
generate_comment_text(undefined_functions, SMFA, _TMFA) ->
io_lib:format("~s is not defined as a function", [SMFA]);
generate_comment_text(locals_not_used, SMFA, _TMFA) ->
io_lib:format("~s is an unused local function", [SMFA]);
generate_comment_text(exports_not_used, SMFA, _TMFA) ->
io_lib:format("~s is an unused export", [SMFA]);
generate_comment_text(deprecated_function_calls, SMFA, TMFA) ->
io_lib:format("~s calls deprecated function ~s", [SMFA, TMFA]);
generate_comment_text(deprecated_functions, SMFA, _TMFA) ->
io_lib:format("~s is deprecated", [SMFA]).

View File

@ -8,8 +8,7 @@ BUILD_DEPS = rabbit_common
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
TEST_DEPS = rabbit rabbitmq_ct_helpers
DEP_PLUGINS = rabbit_common/mk/rabbitmq-macros.mk \
rabbit_common/mk/rabbitmq-build.mk \
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
rabbit_common/mk/rabbitmq-hexpm.mk \
rabbit_common/mk/rabbitmq-dist.mk \
rabbit_common/mk/rabbitmq-run.mk \

View File

@ -27,4 +27,3 @@ cover
/plugins.lock
/sbin/
/sbin.lock
xrefr

View File

@ -2,8 +2,6 @@
A fork of [gmr/httpc-aws](https://github.com/gmr/httpc-aws) for use in building RabbitMQ plugins that interact with Amazon Web Services APIs.
[![Build Status](https://travis-ci.org/gmr/rabbitmq-aws.svg?branch=master)](https://travis-ci.org/gmr/rabbitmq-aws)
## Supported Erlang Versions
[Same as RabbitMQ](http://www.rabbitmq.com/which-erlang.html)

View File

@ -1,7 +1,5 @@
# RabbitMQ CLI Tools
[![Build Status](https://travis-ci.org/rabbitmq/rabbitmq-cli.svg?branch=master)](https://travis-ci.org/rabbitmq/rabbitmq-cli)
This repository contains [RabbitMQ CLI tools](https://rabbitmq.com/cli.html) ([rabbitmqctl](https://www.rabbitmq.com/man/rabbitmqctl.1.man.html) and
others).

View File

@ -14,6 +14,5 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
rabbitmq_consistent_hash_exchange.d

View File

@ -829,10 +829,6 @@ queue weight can be provided at the time of binding.
The state of the hash space is distributed across all cluster nodes.
## Continuous Integration
[![Build Status](https://travis-ci.org/rabbitmq/rabbitmq-consistent-hash-exchange.svg?branch=master)](https://travis-ci.org/rabbitmq/rabbitmq-consistent-hash-exchange)
## Copyright and License
(c) 2007-2024 Broadcom. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.

View File

@ -14,7 +14,6 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
/rabbitmq_ct_client_helpers.d
/.rabbitmq_ct_client_helpers.plt

View File

@ -18,7 +18,6 @@ terraform.tfstate*
/plugins.lock
/sbin/
/sbin.lock
/xrefr
/rabbitmq_ct_helpers.d
/.rabbitmq_ct_helpers.plt

View File

@ -746,7 +746,6 @@ do_start_rabbitmq_node(Config, NodeConfig, I) ->
{"RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=+S 2 +sbwt very_short +A 24 ~ts", [AdditionalErlArgs]},
"RABBITMQ_LOG=debug",
"RMQCTL_WAIT_TIMEOUT=180",
"FAST_RUN_BROKER=0",
{"TEST_TMPDIR=~ts", [PrivDir]}
| ExtraArgs],
Cmd = ["start-background-broker" | MakeVars],

View File

@ -13,6 +13,5 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
rabbitmq_federation.d

View File

@ -1,7 +1,5 @@
## RabbitMQ Federation
[![Build Status](https://travis-ci.org/rabbitmq/rabbitmq-federation.svg?branch=master)](https://travis-ci.org/rabbitmq/rabbitmq-federation)
RabbitMQ federation offers a group of features for loosely
coupled and WAN-friendly distributed RabbitMQ setups. Note that
this is not an alternative to queue mirroring.

View File

@ -17,7 +17,6 @@ MnesiaCore.*
/plugins.lock
/sbin/
/sbin.lock
/xrefr
rabbitmq_management.d
.rabbitmq_management.plt

View File

@ -17,7 +17,6 @@
/sbin/
/sbin.lock
/test/ct.cover.spec
/xrefr
debug/*
*.plt

View File

@ -20,6 +20,5 @@
/sbin.lock
/test/config_schema_SUITE_data/schema/
/test/ct.cover.spec
/xrefr
/rabbitmq_peer_discovery_aws.d

View File

@ -20,6 +20,5 @@
/sbin.lock
/test/config_schema_SUITE_data/schema/
/test/ct.cover.spec
/xrefr
/rabbitmq_peer_discovery_common.d

View File

@ -20,6 +20,5 @@
/sbin.lock
/test/config_schema_SUITE_data/schema/
/test/ct.cover.spec
/xrefr
/rabbitmq_peer_discovery_consul.d

View File

@ -21,6 +21,5 @@ tags
/sbin.lock
/test/config_schema_SUITE_data/schema/
/test/ct.cover.spec
/xrefr
/rabbitmq_peer_discovery_etcd.d

View File

@ -20,6 +20,5 @@
/sbin.lock
/test/config_schema_SUITE_data/schema/
/test/ct.cover.spec
/xrefr
/rabbitmq_peer_discovery_k8s.d

View File

@ -7,7 +7,6 @@
/.erlang.mk/
/logs/
/rabbitmq_prelaunch.d
/xrefr
# Dialyzer
*.plt

View File

@ -13,6 +13,5 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
/rabbitmq_sharding.d

View File

@ -14,7 +14,6 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
elvis
elvis.config

View File

@ -14,7 +14,6 @@
/plugins.lock
/sbin/
/sbin.lock
/xrefr
rabbitmq_stomp.d

View File

@ -12,7 +12,3 @@ it, use [rabbitmq-plugins](https://www.rabbitmq.com/man/rabbitmq-plugins.1.man.h
## Documentation
[RabbitMQ STOMP plugin documentation](https://www.rabbitmq.com/stomp.html).
## Continuous Integration
[![Build Status](https://travis-ci.org/rabbitmq/rabbitmq-stomp.svg?branch=master)](https://travis-ci.org/rabbitmq/rabbitmq-stomp)

View File

@ -28,7 +28,6 @@ erl_crash.dump
/logs/
/plugins/
/sbin/
/xrefr
elvis
callgrind*
ct.coverdata

View File

@ -26,7 +26,6 @@ erl_crash.dump
/ebin/
/logs/
/plugins/
/xrefr
elvis
callgrind*
ct.coverdata

View File

@ -31,7 +31,6 @@ erl_crash.dump
/plugins.lock
/sbin/
/sbin.lock
/xrefr
elvis
callgrind*
ct.coverdata

View File

@ -17,6 +17,5 @@
/_rel/
/sbin/
/test/ct.cover.spec
/xrefr
/trust_store_http.d

View File

@ -366,26 +366,6 @@ khepri_mnesia_migration:
- mnesia_to_khepri
- mnesia_to_khepri_converter
- mnesia_to_khepri_example_converter
looking_glass:
- lg
- lg_callgrind
- lg_file_reader
- lg_file_tracer
- lg_flame
- lg_messages
- lg_messages_seqdiag
- lg_rabbit_hole
- lg_raw_console_tracer
- lg_socket_client
- lg_socket_tracer
- lg_term
- lg_tracer
- lg_tracer_pool
- looking_glass_app
- looking_glass_sup
lz4:
- lz4_nif
- lz4f
meck:
- meck
- meck_args_matcher
@ -678,7 +658,6 @@ rabbit:
- rabbit_log_queue
- rabbit_log_tail
- rabbit_logger_exchange_h
- rabbit_looking_glass
- rabbit_maintenance
- rabbit_message_interceptor
- rabbit_metrics

View File

@ -108,9 +108,8 @@ dep_toke = git_rmq toke $(current_rmq_ref
# Third-party dependencies version pinning.
#
# We do that in this file, which is copied in all projects, to ensure
# all projects use the same versions. It avoids conflicts and makes it
# possible to work with rabbitmq-public-umbrella.
# We do that in this file, which is included by all projects, to ensure
# all projects use the same versions. It avoids conflicts.
dep_accept = hex 0.3.5
dep_cowboy = hex 2.12.0
@ -121,7 +120,6 @@ dep_gen_batch_server = hex 0.8.8
dep_jose = hex 1.11.10
dep_khepri = hex 0.13.0
dep_khepri_mnesia_migration = hex 0.4.0
dep_looking_glass = git https://github.com/rabbitmq/looking_glass.git main
dep_prometheus = hex 4.11.0
dep_ra = hex 2.11.0
dep_ranch = hex 2.1.0
@ -352,38 +350,14 @@ prepare-dist::
@:
# --------------------------------------------------------------------
# Umbrella-specific settings.
# Monorepo-specific settings.
# --------------------------------------------------------------------
# If the top-level project is a RabbitMQ component, we override
# $(DEPS_DIR) for this project to point to the top-level's one.
#
# We also verify that the guessed DEPS_DIR is actually named `deps`,
# to rule out any situation where it is a coincidence that we found a
# `rabbitmq-components.mk` up upper directories.
possible_deps_dir_1 = $(abspath ..)
possible_deps_dir_2 = $(abspath ../../..)
ifeq ($(notdir $(possible_deps_dir_1)),deps)
ifneq ($(wildcard $(possible_deps_dir_1)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_1)
DISABLE_DISTCLEAN = 1
endif
endif
ifeq ($(deps_dir_overriden),)
ifeq ($(notdir $(possible_deps_dir_2)),deps)
ifneq ($(wildcard $(possible_deps_dir_2)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_2)
DISABLE_DISTCLEAN = 1
endif
endif
endif
ifneq ($(wildcard UMBRELLA.md),)
ifneq ($(PROJECT),rabbitmq_server_release)
DEPS_DIR ?= $(abspath ..)
DISABLE_DISTCLEAN = 1
endif