Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit 73f730c

Browse files
committed
Use the new early-stage plugin support from Erlang.mk
With the latest update of Erlang.mk, regular plugins are loaded near the end of `erlang.mk`. This means our plugins can't add any DEPS. Fortunately we can do that from early-stage plugins which are loaded near the beginning of `erlang.mk`. Therefore, we move part of `rabbitmq-build.mk` to `rabbitmq-early-test.mk` because it appends to `$(TEST_DEPS)`. We also create `rabbitmq-early-plugin.mk` wrapper for plugins, like the `rabbitmq-plugin.mk`. A project can now load local plugins, so rabbitmq-common can load them like other projets. We can get rid of the compilation flags duplication because plugins are loaded late enough that they can append to `ERLC_OPTS`. [#144697185]
1 parent af26ddb commit 73f730c

File tree

4 files changed

+84
-90
lines changed

4 files changed

+84
-90
lines changed

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ ERLANG_MK_COMMIT = rabbitmq-tmp
3737

3838
-include development.pre.mk
3939

40+
DEP_EARLY_PLUGINS = $(PROJECT)/mk/rabbitmq-early-test.mk
41+
DEP_PLUGINS = $(PROJECT)/mk/rabbitmq-build.mk \
42+
$(PROJECT)/mk/rabbitmq-hexpm.mk \
43+
$(PROJECT)/mk/rabbitmq-dist.mk \
44+
$(PROJECT)/mk/rabbitmq-test.mk \
45+
$(PROJECT)/mk/rabbitmq-tools.mk
46+
4047
include mk/rabbitmq-components.mk
41-
include mk/rabbitmq-build.mk
4248
include erlang.mk
43-
include mk/rabbitmq-hexpm.mk
44-
include mk/rabbitmq-dist.mk
45-
include mk/rabbitmq-tools.mk
4649

4750
# --------------------------------------------------------------------
4851
# Compilation.

mk/rabbitmq-build.mk

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,7 @@
22
# Compiler flags.
33
# --------------------------------------------------------------------
44

5-
# FIXME: We copy Erlang.mk default flags here: rabbitmq-build.mk is
6-
# loaded as a plugin, so before those variables are defined. And because
7-
# Erlang.mk uses '?=', the flags we set here override the default set.
8-
#
9-
# See: https://github.com/ninenines/erlang.mk/issues/502
10-
11-
WARNING_OPTS += +debug_info \
12-
+warn_export_vars \
13-
+warn_shadow_vars \
14-
+warn_obsolete_guard
15-
ERLC_OPTS += -Werror $(WARNING_OPTS)
16-
TEST_ERLC_OPTS += +nowarn_export_all $(WARNING_OPTS)
5+
TEST_ERLC_OPTS += +nowarn_export_all
176

187
define compare_version
198
$(shell awk 'BEGIN {
@@ -42,77 +31,3 @@ endif
4231
# Push our compilation options to both the normal and test ERLC_OPTS.
4332
ERLC_OPTS += $(RMQ_ERLC_OPTS)
4433
TEST_ERLC_OPTS += $(RMQ_ERLC_OPTS)
45-
46-
# --------------------------------------------------------------------
47-
# Common Test flags.
48-
# --------------------------------------------------------------------
49-
50-
# Enable the following common_test hooks on Travis and Concourse:
51-
#
52-
# cth_fail_fast
53-
# This hook will make sure the first failure puts an end to the
54-
# testsuites; ie. all remaining tests are skipped.
55-
#
56-
# cth_styledout
57-
# This hook will change the output of common_test to something more
58-
# concise and colored.
59-
#
60-
# On Jenkins, in addition to those common_test hooks, enable JUnit-like
61-
# report. Jenkins parses those reports so the results can be browsed
62-
# from its UI. Furthermore, it displays a graph showing evolution of the
63-
# results over time.
64-
65-
CT_HOOKS ?=
66-
67-
RMQ_CT_HOOKS = cth_fail_fast cth_styledout
68-
ifdef TRAVIS
69-
CT_HOOKS += $(RMQ_CT_HOOKS)
70-
TEST_DEPS += $(RMQ_CT_HOOKS)
71-
endif
72-
ifdef CONCOURSE
73-
CT_HOOKS += $(RMQ_CT_HOOKS)
74-
TEST_DEPS += $(RMQ_CT_HOOKS)
75-
endif
76-
ifdef JENKINS_HOME
77-
CT_HOOKS += cth_surefire $(RMQ_CT_HOOKS)
78-
TEST_DEPS += $(RMQ_CT_HOOKS)
79-
endif
80-
81-
dep_cth_fail_fast = git https://github.com/rabbitmq/cth_fail_fast.git master
82-
dep_cth_styledout = git https://github.com/rabbitmq/cth_styledout.git master
83-
84-
CT_HOOKS_PARAM_VALUE = $(patsubst %,and %,$(CT_HOOKS))
85-
CT_OPTS += -ct_hooks $(wordlist 2,$(words $(CT_HOOKS_PARAM_VALUE)),$(CT_HOOKS_PARAM_VALUE))
86-
87-
# Disable most messages on Travis because it might exceed the limit
88-
# set by Travis.
89-
#
90-
# On Concourse, we keep the default verbosity. With Erlang 19.2+, the
91-
# cth_styledout hook will change the output to something concise and all
92-
# messages are available in in HTML reports. With Erlang up-to 19.1,
93-
# stdout will be flooded with messages, but we'll live with that.
94-
#
95-
# CAUTION: All arguments after -erl_args are passed to the emulator and
96-
# common_test doesn't interpret them! Therefore, all common_test flags
97-
# *MUST* appear before.
98-
99-
CT_QUIET_FLAGS = -verbosity 50 \
100-
-erl_args \
101-
-kernel error_logger silent
102-
103-
ifdef TRAVIS
104-
CT_OPTS += $(CT_QUIET_FLAGS)
105-
endif
106-
107-
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
108-
# testsuite/testgroup/testcase is considered an error.
109-
110-
ifdef TRAVIS
111-
export RABBITMQ_CT_SKIP_AS_ERROR = true
112-
endif
113-
ifdef CONCOURSE
114-
export RABBITMQ_CT_SKIP_AS_ERROR = true
115-
endif
116-
ifdef JENKINS_HOME
117-
export RABBITMQ_CT_SKIP_AS_ERROR = true
118-
endif

mk/rabbitmq-early-plugin.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ifeq ($(filter rabbitmq-early-test.mk,$(notdir $(MAKEFILE_LIST))),)
2+
include $(dir $(lastword $(MAKEFILE_LIST)))rabbitmq-early-test.mk
3+
endif

mk/rabbitmq-early-test.mk

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# --------------------------------------------------------------------
2+
# Common Test flags.
3+
# --------------------------------------------------------------------
4+
5+
# Enable the following common_test hooks on Travis and Concourse:
6+
#
7+
# cth_fail_fast
8+
# This hook will make sure the first failure puts an end to the
9+
# testsuites; ie. all remaining tests are skipped.
10+
#
11+
# cth_styledout
12+
# This hook will change the output of common_test to something more
13+
# concise and colored.
14+
#
15+
# On Jenkins, in addition to those common_test hooks, enable JUnit-like
16+
# report. Jenkins parses those reports so the results can be browsed
17+
# from its UI. Furthermore, it displays a graph showing evolution of the
18+
# results over time.
19+
20+
CT_HOOKS ?=
21+
22+
RMQ_CT_HOOKS = cth_fail_fast cth_styledout
23+
ifdef TRAVIS
24+
CT_HOOKS += $(RMQ_CT_HOOKS)
25+
TEST_DEPS += $(RMQ_CT_HOOKS)
26+
endif
27+
ifdef CONCOURSE
28+
CT_HOOKS += $(RMQ_CT_HOOKS)
29+
TEST_DEPS += $(RMQ_CT_HOOKS)
30+
endif
31+
ifdef JENKINS_HOME
32+
CT_HOOKS += cth_surefire $(RMQ_CT_HOOKS)
33+
TEST_DEPS += $(RMQ_CT_HOOKS)
34+
endif
35+
36+
dep_cth_fail_fast = git https://github.com/rabbitmq/cth_fail_fast.git master
37+
dep_cth_styledout = git https://github.com/rabbitmq/cth_styledout.git master
38+
39+
CT_HOOKS_PARAM_VALUE = $(patsubst %,and %,$(CT_HOOKS))
40+
CT_OPTS += -ct_hooks $(wordlist 2,$(words $(CT_HOOKS_PARAM_VALUE)),$(CT_HOOKS_PARAM_VALUE))
41+
42+
# Disable most messages on Travis because it might exceed the limit
43+
# set by Travis.
44+
#
45+
# On Concourse, we keep the default verbosity. With Erlang 19.2+, the
46+
# cth_styledout hook will change the output to something concise and all
47+
# messages are available in in HTML reports. With Erlang up-to 19.1,
48+
# stdout will be flooded with messages, but we'll live with that.
49+
#
50+
# CAUTION: All arguments after -erl_args are passed to the emulator and
51+
# common_test doesn't interpret them! Therefore, all common_test flags
52+
# *MUST* appear before.
53+
54+
CT_QUIET_FLAGS = -verbosity 50 \
55+
-erl_args \
56+
-kernel error_logger silent
57+
58+
ifdef TRAVIS
59+
CT_OPTS += $(CT_QUIET_FLAGS)
60+
endif
61+
62+
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
63+
# testsuite/testgroup/testcase is considered an error.
64+
65+
ifdef TRAVIS
66+
export RABBITMQ_CT_SKIP_AS_ERROR = true
67+
endif
68+
ifdef CONCOURSE
69+
export RABBITMQ_CT_SKIP_AS_ERROR = true
70+
endif
71+
ifdef JENKINS_HOME
72+
export RABBITMQ_CT_SKIP_AS_ERROR = true
73+
endif

0 commit comments

Comments
 (0)