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

Commit 883f554

Browse files
Merge branch 'master' into rabbitmq-server-1146-full
Conflicts: src/rabbit_amqqueue.erl
2 parents e3bdb86 + 5a6d690 commit 883f554

12 files changed

+301
-217
lines changed

erlang.mk

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))
1818

19-
ERLANG_MK_VERSION = 2.0.0-pre.2-207-g9e9b7d2
19+
ERLANG_MK_VERSION = 2.0.0-pre.2-220-g7a200f5
2020

2121
# Make 3.81 and 3.82 are deprecated.
2222

@@ -4203,17 +4203,16 @@ endif
42034203
# in practice only Makefile is needed so far.
42044204
define dep_autopatch
42054205
if [ -f $(DEPS_DIR)/$(1)/erlang.mk ]; then \
4206+
rm -rf $(DEPS_DIR)/$1/ebin/; \
42064207
$(call erlang,$(call dep_autopatch_appsrc.erl,$(1))); \
42074208
$(call dep_autopatch_erlang_mk,$(1)); \
42084209
elif [ -f $(DEPS_DIR)/$(1)/Makefile ]; then \
42094210
if [ 0 != `grep -c "include ../\w*\.mk" $(DEPS_DIR)/$(1)/Makefile` ]; then \
42104211
$(call dep_autopatch2,$(1)); \
4211-
elif [ 0 != `grep -ci rebar $(DEPS_DIR)/$(1)/Makefile` ]; then \
4212+
elif [ 0 != `grep -ci "^[^#].*rebar" $(DEPS_DIR)/$(1)/Makefile` ]; then \
42124213
$(call dep_autopatch2,$(1)); \
4213-
elif [ -n "`find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk -exec grep -i rebar '{}' \;`" ]; then \
4214+
elif [ -n "`find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk -exec grep -i "^[^#].*rebar" '{}' \;`" ]; then \
42144215
$(call dep_autopatch2,$(1)); \
4215-
else \
4216-
$(call erlang,$(call dep_autopatch_app.erl,$(1))); \
42174216
fi \
42184217
else \
42194218
if [ ! -d $(DEPS_DIR)/$(1)/src/ ]; then \
@@ -4225,6 +4224,8 @@ define dep_autopatch
42254224
endef
42264225

42274226
define dep_autopatch2
4227+
mv -n $(DEPS_DIR)/$1/ebin/$1.app $(DEPS_DIR)/$1/src/$1.app.src; \
4228+
rm -f $(DEPS_DIR)/$1/ebin/$1.app; \
42284229
if [ -f $(DEPS_DIR)/$1/src/$1.app.src.script ]; then \
42294230
$(call erlang,$(call dep_autopatch_appsrc_script.erl,$(1))); \
42304231
fi; \
@@ -4536,22 +4537,6 @@ define dep_autopatch_rebar.erl
45364537
halt()
45374538
endef
45384539

4539-
define dep_autopatch_app.erl
4540-
UpdateModules = fun(App) ->
4541-
case filelib:is_regular(App) of
4542-
false -> ok;
4543-
true ->
4544-
{ok, [{application, '$(1)', L0}]} = file:consult(App),
4545-
Mods = filelib:fold_files("$(call core_native_path,$(DEPS_DIR)/$1/src)", "\\\\.erl$$", true,
4546-
fun (F, Acc) -> [list_to_atom(filename:rootname(filename:basename(F)))|Acc] end, []),
4547-
L = lists:keystore(modules, 1, L0, {modules, Mods}),
4548-
ok = file:write_file(App, io_lib:format("~p.~n", [{application, '$(1)', L}]))
4549-
end
4550-
end,
4551-
UpdateModules("$(call core_native_path,$(DEPS_DIR)/$1/ebin/$1.app)"),
4552-
halt()
4553-
endef
4554-
45554540
define dep_autopatch_appsrc_script.erl
45564541
AppSrc = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)",
45574542
AppSrcScript = AppSrc ++ ".script",
@@ -4828,6 +4813,8 @@ COMPILE_FIRST_PATHS = $(addprefix src/,$(addsuffix .erl,$(COMPILE_FIRST)))
48284813
ERLC_EXCLUDE ?=
48294814
ERLC_EXCLUDE_PATHS = $(addprefix src/,$(addsuffix .erl,$(ERLC_EXCLUDE)))
48304815

4816+
ERLC_ASN1_OPTS ?=
4817+
48314818
ERLC_MIB_OPTS ?=
48324819
COMPILE_MIB_FIRST ?=
48334820
COMPILE_MIB_FIRST_PATHS = $(addprefix mibs/,$(addsuffix .mib,$(COMPILE_MIB_FIRST)))
@@ -4877,7 +4864,7 @@ endif
48774864

48784865
ifeq ($(wildcard src/$(PROJECT_MOD).erl),)
48794866
define app_file
4880-
{application, $(PROJECT), [
4867+
{application, '$(PROJECT)', [
48814868
{description, "$(PROJECT_DESCRIPTION)"},
48824869
{vsn, "$(PROJECT_VERSION)"},$(if $(IS_DEP),
48834870
{id$(comma)$(space)"$(1)"}$(comma))
@@ -4889,7 +4876,7 @@ define app_file
48894876
endef
48904877
else
48914878
define app_file
4892-
{application, $(PROJECT), [
4879+
{application, '$(PROJECT)', [
48934880
{description, "$(PROJECT_DESCRIPTION)"},
48944881
{vsn, "$(PROJECT_VERSION)"},$(if $(IS_DEP),
48954882
{id$(comma)$(space)"$(1)"}$(comma))
@@ -4920,7 +4907,7 @@ ERL_FILES += $(addprefix src/,$(patsubst %.asn1,%.erl,$(notdir $(ASN1_FILES))))
49204907

49214908
define compile_asn1
49224909
$(verbose) mkdir -p include/
4923-
$(asn1_verbose) erlc -v -I include/ -o asn1/ +noobj $(1)
4910+
$(asn1_verbose) erlc -v -I include/ -o asn1/ +noobj $(ERLC_ASN1_OPTS) $(1)
49244911
$(verbose) mv asn1/*.erl src/
49254912
$(verbose) mv asn1/*.hrl include/
49264913
$(verbose) mv asn1/*.asn1db include/
@@ -5052,7 +5039,7 @@ $(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):
50525039
ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change
50535040
endif
50545041

5055-
-include $(PROJECT).d
5042+
include $(wildcard $(PROJECT).d)
50565043

50575044
ebin/$(PROJECT).app:: ebin/
50585045

@@ -5277,6 +5264,7 @@ MAN_VERSION ?= $(PROJECT_VERSION)
52775264
define asciidoc2man.erl
52785265
try
52795266
[begin
5267+
io:format(" ADOC ~s~n", [F]),
52805268
ok = asciideck:to_manpage(asciideck:parse_file(F), #{
52815269
compress => gzip,
52825270
outdir => filename:dirname(F),
@@ -5285,7 +5273,8 @@ try
52855273
})
52865274
end || F <- [$(shell echo $(addprefix $(comma)\",$(addsuffix \",$1)) | sed 's/^.//')]],
52875275
halt(0)
5288-
catch _:_ ->
5276+
catch C:E ->
5277+
io:format("Exception ~p:~p~nStacktrace: ~p~n", [C, E, erlang:get_stacktrace()]),
52895278
halt(1)
52905279
end.
52915280
endef
@@ -6123,6 +6112,7 @@ CT_SUITES := $(sort $(subst _SUITE.erl,,$(notdir $(call core_find,$(TEST_DIR)/,*
61236112
endif
61246113
endif
61256114
CT_SUITES ?=
6115+
CT_LOGS_DIR ?= $(CURDIR)/logs
61266116

61276117
# Core targets.
61286118

@@ -6145,13 +6135,13 @@ CT_RUN = ct_run \
61456135
-noinput \
61466136
-pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(APPS_DIR)/*/ebin $(TEST_DIR) \
61476137
-dir $(TEST_DIR) \
6148-
-logdir $(CURDIR)/logs
6138+
-logdir $(CT_LOGS_DIR)
61496139

61506140
ifeq ($(CT_SUITES),)
61516141
ct: $(if $(IS_APP),,apps-ct)
61526142
else
61536143
ct: test-build $(if $(IS_APP),,apps-ct)
6154-
$(verbose) mkdir -p $(CURDIR)/logs/
6144+
$(verbose) mkdir -p $(CT_LOGS_DIR)
61556145
$(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
61566146
endif
61576147

@@ -6179,14 +6169,14 @@ endif
61796169

61806170
define ct_suite_target
61816171
ct-$(1): test-build
6182-
$(verbose) mkdir -p $(CURDIR)/logs/
6172+
$(verbose) mkdir -p $(CT_LOGS_DIR)
61836173
$(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS)
61846174
endef
61856175

61866176
$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test))))
61876177

61886178
distclean-ct:
6189-
$(gen_verbose) rm -rf $(CURDIR)/logs/
6179+
$(gen_verbose) rm -rf $(CT_LOGS_DIR)
61906180

61916181
# Copyright (c) 2013-2016, Loïc Hoguin <[email protected]>
61926182
# This file is part of erlang.mk and subject to the terms of the ISC License.
@@ -6232,8 +6222,10 @@ define filter_opts.erl
62326222
endef
62336223

62346224
$(DIALYZER_PLT): deps app
6235-
$(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) \
6236-
`test -f $(ERLANG_MK_TMP)/deps.log && cat $(ERLANG_MK_TMP)/deps.log`
6225+
$(eval DEPS_LOG := $(shell test -f $(ERLANG_MK_TMP)/deps.log && \
6226+
while read p; do test -d $$p/ebin && echo $$p/ebin; done <$(ERLANG_MK_TMP)/deps.log))
6227+
$(verbose) dialyzer --build_plt --apps erts kernel stdlib \
6228+
$(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS_LOG)
62376229

62386230
plt: $(DIALYZER_PLT)
62396231

@@ -6319,7 +6311,7 @@ escript:: escript-zip
63196311
$(verbose) chmod +x $(ESCRIPT_FILE)
63206312

63216313
distclean-escript:
6322-
$(gen_verbose) rm -f $(ESCRIPT_NAME)
6314+
$(gen_verbose) rm -f $(ESCRIPT_FILE)
63236315

63246316
# Copyright (c) 2015-2016, Loïc Hoguin <[email protected]>
63256317
# Copyright (c) 2014, Enrique Fernandez <[email protected]>
@@ -6495,6 +6487,20 @@ build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
64956487
shell: build-shell-deps
64966488
$(gen_verbose) $(SHELL_ERL) -pa $(SHELL_PATHS) $(SHELL_OPTS)
64976489

6490+
# Copyright (c) 2017, Jean-Sébastien Pédron <[email protected]>
6491+
# This file is contributed to erlang.mk and subject to the terms of the ISC License.
6492+
6493+
.PHONY: show-ERL_LIBS show-ERLC_OPTS show-TEST_ERLC_OPTS
6494+
6495+
show-ERL_LIBS:
6496+
@echo $(ERL_LIBS)
6497+
6498+
show-ERLC_OPTS:
6499+
@$(foreach opt,$(ERLC_OPTS) -pa ebin -I include,echo "$(opt)";)
6500+
6501+
show-TEST_ERLC_OPTS:
6502+
@$(foreach opt,$(TEST_ERLC_OPTS) -pa ebin -I include,echo "$(opt)";)
6503+
64986504
# Copyright (c) 2015-2016, Loïc Hoguin <[email protected]>
64996505
# This file is part of erlang.mk and subject to the terms of the ISC License.
65006506

mk/rabbitmq-build.mk

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,40 @@ ERLC_OPTS += $(RMQ_ERLC_OPTS)
7474
TEST_ERLC_OPTS += $(RMQ_ERLC_OPTS)
7575

7676
# --------------------------------------------------------------------
77-
# Common test flags.
77+
# Common Test flags.
7878
# --------------------------------------------------------------------
7979

80-
# Enable the cth_fail_fast common_test hook on Concourse.
80+
# Enable the following common_test hooks on Travis and Concourse:
8181
#
82-
# This hook will make sure the first failure puts an end to the
83-
# testsuites; ie. all remaining tests are skipped.
82+
# cth_fail_fast
83+
# This hook will make sure the first failure puts an end to the
84+
# testsuites; ie. all remaining tests are skipped.
85+
#
86+
# cth_styledout
87+
# This hook will change the output of common_test to something more
88+
# consise and colored.
8489

85-
ifdef CONCOURSE
86-
TEST_DEPS += cth_fail_fast
90+
CTH_DEPS = cth_fail_fast cth_styledout
8791
dep_cth_fail_fast = git https://github.com/rabbitmq/cth_fail_fast.git master
88-
CT_OPTS += -ct_hooks cth_fail_fast
92+
dep_cth_styledout = git https://github.com/rabbitmq/cth_styledout.git master
93+
CTH_OPTS = -ct_hooks cth_fail_fast and cth_styledout
94+
95+
ifdef TRAVIS
96+
TEST_DEPS += $(CTH_DEPS)
97+
CT_OPTS += $(CTH_OPTS)
98+
endif
99+
ifdef CONCOURSE
100+
TEST_DEPS += $(CTH_DEPS)
101+
CT_OPTS += $(CTH_OPTS)
89102
endif
90103

91-
# Disable most messages on Travis and Concourse.
104+
# Disable most messages on Travis because it might exceed the limit
105+
# set by Travis.
92106
#
93-
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
94-
# testsuite/testgroup/testcase is considered an error.
107+
# On Concourse, we keep the default verbosity. With Erlang 19.2+, the
108+
# cth_styledout hook will change the output to something concise and all
109+
# messages are available in in HTML reports. With Erlang up-to 19.1,
110+
# stdout will be flooded with messages, but we'll live with that.
95111
#
96112
# CAUTION: All arguments after -erl_args are passed to the emulator and
97113
# common_test doesn't interpret them! Therefore, all common_test flags
@@ -103,17 +119,25 @@ CT_QUIET_FLAGS = -verbosity 50 \
103119

104120
ifdef TRAVIS
105121
CT_OPTS += $(CT_QUIET_FLAGS)
106-
export RABBITMQ_CT_SKIP_AS_ERROR = true
107-
endif
108-
ifdef CONCOURSE
109-
CT_OPTS += $(CT_QUIET_FLAGS)
110-
export RABBITMQ_CT_SKIP_AS_ERROR = true
111122
endif
112123

113124
# Enable JUnit-like report on Jenkins. Jenkins parses those reports so
114125
# the results can be browsed from its UI. Furthermore, it displays a
115126
# graph showing evolution of the results over time.
127+
116128
ifdef JENKINS_HOME
117129
CT_OPTS += -ct_hooks cth_surefire
130+
endif
131+
132+
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
133+
# testsuite/testgroup/testcase is considered an error.
134+
135+
ifdef TRAVIS
136+
export RABBITMQ_CT_SKIP_AS_ERROR = true
137+
endif
138+
ifdef CONCOURSE
139+
export RABBITMQ_CT_SKIP_AS_ERROR = true
140+
endif
141+
ifdef JENKINS_HOME
118142
export RABBITMQ_CT_SKIP_AS_ERROR = true
119143
endif

mk/rabbitmq-dist.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dist_verbose = $(dist_verbose_$(V))
99

1010
MIX_ARCHIVES ?= $(HOME)/.mix/archives
1111

12-
MIX_TASK_ARCHIVE_DEPS_VERSION = 0.3.0
12+
MIX_TASK_ARCHIVE_DEPS_VERSION = 0.4.0
1313
mix_task_archive_deps = $(MIX_ARCHIVES)/mix_task_archive_deps-$(MIX_TASK_ARCHIVE_DEPS_VERSION)
1414

1515
# We take the version of an Erlang application from the .app file. This
@@ -31,7 +31,7 @@ endef
3131
define get_mix_project_version
3232
$(shell cd $(1) && \
3333
$(MIX) do deps.get, deps.compile, compile >/dev/null && \
34-
$(MIX) run -e "IO.puts(Mix.Project.config[:version])")
34+
$(MIX) run --no-start -e "IO.puts(Mix.Project.config[:version])")
3535
endef
3636

3737
# Define the target to create an .ez plugin archive for an
@@ -64,6 +64,8 @@ $$(dist_$(1)_ez): $$(patsubst %,$(3)/%, \
6464
APP=$(1) VSN=$(2) EZ_DIR=$$(abspath $$(dist_$(1)_ez_dir))))
6565
endif
6666

67+
ERLANGMK_DIST_APPS += $(1)
68+
6769
ERLANGMK_DIST_EZS += $$(dist_$(1)_ez)
6870

6971
endef
@@ -76,7 +78,7 @@ endef
7678
define get_mix_project_dep_ezs
7779
$(shell cd $(1) && \
7880
$(MIX) do deps.get, deps.compile, compile >/dev/null && \
79-
$(MIX) archive.build.all.list -e -o $(DIST_DIR))
81+
$(MIX) archive.build.all.list -e -o $(DIST_DIR) --skip "rabbit $(ERLANGMK_DIST_APPS)")
8082
endef
8183

8284
define do_ez_target_mix
@@ -89,6 +91,8 @@ $$(dist_$(1)_ez): VSN = $(2)
8991
$$(dist_$(1)_ez): SRC_DIR = $(3)
9092
$$(dist_$(1)_ez): EZ_DIR = $$(abspath $$(dist_$(1)_ez_dir))
9193
$$(dist_$(1)_ez): EZ = $$(dist_$(1)_ez)
94+
$$(dist_$(1)_ez): $$(if $$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),\
95+
$$(call core_find,$$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),*),)
9296

9397
MIX_DIST_EZS += $$(dist_$(1)_ez)
9498
EXTRA_DIST_EZS += $$(call get_mix_project_dep_ezs,$(3))
@@ -175,7 +179,7 @@ $(ERLANGMK_DIST_EZS):
175179
$(MIX_DIST_EZS): $(mix_task_archive_deps)
176180
$(verbose) cd $(SRC_DIR) && \
177181
$(MIX) do deps.get, deps.compile, compile, archive.build.all \
178-
-e -o $(abspath $(DIST_DIR))
182+
-e -o $(abspath $(DIST_DIR)) --skip "rabbit $(ERLANGMK_DIST_APPS)"
179183

180184
MIX_TASK_ARCHIVE_DEPS_URL = https://github.com/hairyhum/mix_task_archive_deps/releases/download/$(MIX_TASK_ARCHIVE_DEPS_VERSION)/mix_task_archive_deps-$(MIX_TASK_ARCHIVE_DEPS_VERSION).ez
181185

mk/rabbitmq-tools.mk

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,3 @@ show-branch: $(READY_DEPS:%=$(DEPS_DIR)/%+show-branch)
7373
$(verbose) printf '%-34s %s\n' $(notdir $*): "$$(cd $* && (git symbolic-ref -q --short HEAD || git describe --tags --exact-match))"
7474

7575
endif # ($(wildcard .git),)
76-
77-
.PHONY: show-ERL_LIBS show-ERLC_OPTS show-TEST_ERLC_OPTS
78-
79-
show-ERL_LIBS:
80-
@echo $(ERL_LIBS)
81-
82-
show-ERLC_OPTS:
83-
@$(foreach opt,$(ERLC_OPTS) -pa ebin -I include,echo "$(opt)";)
84-
85-
show-TEST_ERLC_OPTS:
86-
@$(foreach opt,$(TEST_ERLC_OPTS) -pa ebin -I include,echo "$(opt)";)

0 commit comments

Comments
 (0)