Skip to content

Commit 769f19b

Browse files
author
Loïc Hoguin
committed
make: Don't build dist for run-broker by default
During development we want `make run-broker` to execute fast, yet still pick up the changes we made in rabbit applications. We can already do this by setting the appropriate variables. This commit makes it so that this is the default. Now instead of depending on the `dist` target we run plugins from the deps/ directory. And we depend on `all` to pick up changes. This is equivalent to running `make run-broker PLUGINS_FROM_DEPS_DIR=1 DIST_TARGET=all`. It can be disabled by setting `FAST_RUN_BROKER=0`. It doesn't invalide the `NOBUILD=1` variable which lets us run the broker without recompiling (used in tests). It also doesn't make `NOBUILD=1` faster (or slower). The difference when running `make run-broker` by default is roughly half the time of what it was before: make run-broker 16,67s user 10,42s system 101% cpu 26,567 total make run-broker 8,75s user 4,40s system 102% cpu 12,873 total And it also applies to `make start-cluster`: make start-cluster 26,32s user 15,15s system 141% cpu 29,279 total make start-cluster 18,09s user 8,76s system 170% cpu 15,726 total
1 parent 706ebde commit 769f19b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

deps/rabbit_common/mk/rabbitmq-run.mk

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,22 @@ RABBITMQ_ENABLED_PLUGINS_FILE ?= $(call node_enabled_plugins_file,$(RABBITMQ_NOD
9696
RABBITMQ_LOG ?= debug,+color
9797
export RABBITMQ_LOG
9898

99-
# erlang.mk adds dependencies' ebin directory to ERL_LIBS. This is
100-
# a sane default, but we prefer to rely on the .ez archives in the
101-
# `plugins` directory so the plugin code is executed. The `plugins`
102-
# directory is added to ERL_LIBS by rabbitmq-env.
103-
DIST_ERL_LIBS = $(patsubst :%,%,$(patsubst %:,%,$(subst :$(APPS_DIR):,:,$(subst :$(DEPS_DIR):,:,:$(ERL_LIBS):))))
99+
FAST_RUN_BROKER ?= 1
100+
101+
ifeq ($(FAST_RUN_BROKER),1)
102+
DIST_TARGET = $(if $(NOBUILD),,all)
103+
PLUGINS_FROM_DEPS_DIR = 1
104+
endif
104105

105106
ifdef PLUGINS_FROM_DEPS_DIR
106-
RMQ_PLUGINS_DIR=$(DEPS_DIR)
107+
RMQ_PLUGINS_DIR = $(DEPS_DIR)
108+
DIST_ERL_LIBS = $(ERL_LIBS)
107109
else
108-
RMQ_PLUGINS_DIR=$(CURDIR)/$(DIST_DIR)
110+
RMQ_PLUGINS_DIR = $(CURDIR)/$(DIST_DIR)
111+
# We do not want to add apps/ or deps/ to ERL_LIBS
112+
# when running the release from dist. The `plugins`
113+
# directory is added to ERL_LIBS by rabbitmq-env.
114+
DIST_ERL_LIBS = $(patsubst :%,%,$(patsubst %:,%,$(subst :$(APPS_DIR):,:,$(subst :$(DEPS_DIR):,:,:$(ERL_LIBS):))))
109115
endif
110116

111117
node_plugins_dir = $(if $(RABBITMQ_PLUGINS_DIR),$(RABBITMQ_PLUGINS_DIR),$(if $(EXTRA_PLUGINS_DIR),$(EXTRA_PLUGINS_DIR):$(RMQ_PLUGINS_DIR),$(RMQ_PLUGINS_DIR)))

0 commit comments

Comments
 (0)