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

Commit 5be0f03

Browse files
author
Daniil Fedotov
committed
Merge branch 'master' into rabbitmq-server-567
2 parents 164f876 + 59cd2ca commit 5be0f03

12 files changed

+237
-84
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
.sw?
33
.*.sw?
44
*.beam
5+
*.coverdata
56
/.erlang.mk/
67
/cover/
78
/deps/
89
/doc/
910
/ebin/
11+
/git-revisions.txt
1012
/logs/
1113
/plugins/
14+
/rebar.config
15+
/rebar.lock
16+
/test/ct.cover.spec
1217
/xrefr
1318

1419
/rabbit_common.d

.travis.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
1-
sudo: false
1+
# vim:sw=2:et:
2+
3+
# Use a real VM so we can install all the packages we want.
4+
sudo: required
5+
26
language: erlang
37
notifications:
48
email:
59
610
addons:
711
apt:
12+
sources:
13+
- sourceline: deb https://packages.erlang-solutions.com/ubuntu precise contrib
14+
key_url: https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
815
packages:
16+
# Use Elixir from Erlang Solutions. The provided Elixir is
17+
# installed with kiex but is old. By using an prebuilt Debian
18+
# package, we save the compilation time.
19+
- elixir
920
- xsltproc
1021
otp_release:
1122
- "18.3"
1223
- "19.0"
1324

14-
# The checkout made by Travis is a "detached HEAD" and branches
15-
# information is missing. Our Erlang.mk's git_rmq fetch method relies on
16-
# it, so we need to restore it.
17-
#
18-
# We simply fetch master and, if it exists, stable branches. A branch is
19-
# created, pointing to the detached HEAD.
2025
before_script:
26+
# The checkout made by Travis is a "detached HEAD" and branches
27+
# information is missing. Our Erlang.mk's git_rmq fetch method relies
28+
# on it, so we need to restore it.
29+
#
30+
# We simply fetch master and, if it exists, stable branches. A branch
31+
# is created, pointing to the detached HEAD.
2132
- |
2233
git checkout -B "${TRAVIS_TAG:-${TRAVIS_BRANCH}}"
2334
git remote add upstream https://github.com/$TRAVIS_REPO_SLUG.git
2435
git fetch upstream stable:stable || :
2536
git fetch upstream master:master || :
37+
# Remove all kiex installations. This makes sure that the Erlang
38+
# Solutions one is picked: it's after the kiex installations in $PATH.
39+
- echo YES | kiex implode
2640

2741
script: make tests
2842

Makefile

Lines changed: 32 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,47 @@
11
PROJECT = rabbit_common
2-
3-
BUILD_DEPS = rabbitmq_codegen
2+
PROJECT_DESCRIPTION = Modules shared by rabbitmq-server and rabbitmq-erlang-client
3+
4+
define PROJECT_APP_EXTRA_KEYS
5+
%% Hex.pm package informations.
6+
{maintainers, [
7+
"RabbitMQ Team <[email protected]>",
8+
"Jean-Sebastien Pedron <[email protected]>"
9+
]},
10+
{licenses, ["MPL 1.1"]},
11+
{links, [
12+
{"Website", "http://www.rabbitmq.com/"},
13+
{"GitHub", "https://github.com/rabbitmq/rabbitmq-common"}
14+
]},
15+
{build_tools, ["make", "rebar3"]},
16+
{files, [
17+
$(RABBITMQ_HEXPM_DEFAULT_FILES),
18+
"mk"
19+
]}
20+
endef
21+
22+
LOCAL_DEPS = compiler syntax_tools xmerl
423
DEPS = lager jsx
5-
TEST_DEPS = proper
6-
7-
.DEFAULT_GOAL = all
8-
9-
EXTRA_SOURCES += include/rabbit_framing.hrl \
10-
src/rabbit_framing_amqp_0_8.erl \
11-
src/rabbit_framing_amqp_0_9_1.erl
12-
13-
.DEFAULT_GOAL = all
14-
$(PROJECT).d:: $(EXTRA_SOURCES)
1524

1625
# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be
1726
# reviewed and merged.
1827

1928
ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git
2029
ERLANG_MK_COMMIT = rabbitmq-tmp
2130

31+
# Variables and recipes in development.*.mk are meant to be used from
32+
# any Git clone. They are excluded from the files published to Hex.pm.
33+
# Generated files are published to Hex.pm however so people using this
34+
# source won't have to depend on Python and rabbitmq-codegen.
35+
#
36+
# That's why those Makefiles are included with `-include`: we ignore any
37+
# inclusion errors.
38+
39+
-include development.pre.mk
40+
2241
include mk/rabbitmq-components.mk
2342
include erlang.mk
2443
include mk/rabbitmq-build.mk
2544
include mk/rabbitmq-dist.mk
2645
include mk/rabbitmq-tools.mk
2746

28-
# --------------------------------------------------------------------
29-
# Framing sources generation.
30-
# --------------------------------------------------------------------
31-
32-
PYTHON ?= python
33-
CODEGEN = $(CURDIR)/codegen.py
34-
CODEGEN_DIR ?= $(DEPS_DIR)/rabbitmq_codegen
35-
CODEGEN_AMQP = $(CODEGEN_DIR)/amqp_codegen.py
36-
37-
AMQP_SPEC_JSON_FILES_0_8 = $(CODEGEN_DIR)/amqp-rabbitmq-0.8.json
38-
AMQP_SPEC_JSON_FILES_0_9_1 = $(CODEGEN_DIR)/amqp-rabbitmq-0.9.1.json \
39-
$(CODEGEN_DIR)/credit_extension.json
40-
41-
include/rabbit_framing.hrl:: $(CODEGEN) $(CODEGEN_AMQP) \
42-
$(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8)
43-
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
44-
$(PYTHON) $(CODEGEN) --ignore-conflicts header \
45-
$(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8) $@
46-
47-
src/rabbit_framing_amqp_0_9_1.erl:: $(CODEGEN) $(CODEGEN_AMQP) \
48-
$(AMQP_SPEC_JSON_FILES_0_9_1)
49-
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
50-
$(PYTHON) $(CODEGEN) body $(AMQP_SPEC_JSON_FILES_0_9_1) $@
51-
52-
src/rabbit_framing_amqp_0_8.erl:: $(CODEGEN) $(CODEGEN_AMQP) \
53-
$(AMQP_SPEC_JSON_FILES_0_8)
54-
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
55-
$(PYTHON) $(CODEGEN) body $(AMQP_SPEC_JSON_FILES_0_8) $@
56-
57-
clean:: clean-extra-sources
58-
59-
clean-extra-sources:
60-
$(gen_verbose) rm -f $(EXTRA_SOURCES)
47+
-include development.post.mk

development.post.mk

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# --------------------------------------------------------------------
2+
# Framing sources generation.
3+
# --------------------------------------------------------------------
4+
5+
PYTHON ?= python
6+
CODEGEN = $(CURDIR)/codegen.py
7+
CODEGEN_DIR ?= $(DEPS_DIR)/rabbitmq_codegen
8+
CODEGEN_AMQP = $(CODEGEN_DIR)/amqp_codegen.py
9+
10+
AMQP_SPEC_JSON_FILES_0_8 = $(CODEGEN_DIR)/amqp-rabbitmq-0.8.json
11+
AMQP_SPEC_JSON_FILES_0_9_1 = $(CODEGEN_DIR)/amqp-rabbitmq-0.9.1.json \
12+
$(CODEGEN_DIR)/credit_extension.json
13+
14+
include/rabbit_framing.hrl:: $(CODEGEN) $(CODEGEN_AMQP) \
15+
$(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8)
16+
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
17+
$(PYTHON) $(CODEGEN) --ignore-conflicts header \
18+
$(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8) $@
19+
20+
src/rabbit_framing_amqp_0_9_1.erl:: $(CODEGEN) $(CODEGEN_AMQP) \
21+
$(AMQP_SPEC_JSON_FILES_0_9_1)
22+
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
23+
$(PYTHON) $(CODEGEN) body $(AMQP_SPEC_JSON_FILES_0_9_1) $@
24+
25+
src/rabbit_framing_amqp_0_8.erl:: $(CODEGEN) $(CODEGEN_AMQP) \
26+
$(AMQP_SPEC_JSON_FILES_0_8)
27+
$(gen_verbose) env PYTHONPATH=$(CODEGEN_DIR) \
28+
$(PYTHON) $(CODEGEN) body $(AMQP_SPEC_JSON_FILES_0_8) $@
29+
30+
clean:: clean-extra-sources
31+
32+
clean-extra-sources:
33+
$(gen_verbose) rm -f $(EXTRA_SOURCES)

development.pre.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Variables and recipes in development.*.mk are meant to be used from
2+
# any Git clone. They are excluded from the files published to Hex.pm.
3+
# Generated files are published to Hex.pm however so people using this
4+
# source won't have to depend on Python and rabbitmq-codegen.
5+
6+
BUILD_DEPS = rabbitmq_codegen
7+
TEST_DEPS = proper
8+
9+
EXTRA_SOURCES += include/rabbit_framing.hrl \
10+
src/rabbit_framing_amqp_0_8.erl \
11+
src/rabbit_framing_amqp_0_9_1.erl
12+
13+
.DEFAULT_GOAL = all
14+
$(PROJECT).d:: $(EXTRA_SOURCES)

include/rabbit.hrl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@
242242
-define(EMPTY_FRAME_SIZE, 8).
243243

244244
-define(MAX_WAIT, 16#ffffffff).
245-
-define(SUPERVISOR_WAIT, infinity).
246-
-define(WORKER_WAIT, 30000).
245+
-define(SUPERVISOR_WAIT,
246+
rabbit_misc:get_env(rabbit, supervisor_shutdown_timeout, infinity)).
247+
-define(WORKER_WAIT,
248+
rabbit_misc:get_env(rabbit, worker_shutdown_timeout, 30000)).
247249

248250
-define(HIBERNATE_AFTER_MIN, 1000).
249251
-define(DESIRED_HIBERNATE, 10000).

mk/rabbitmq-build.mk

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,76 @@ TEST_ERLC_OPTS += $(RMQ_ERLC_OPTS)
5454

5555
# Disable most messages on Travis and Concourse.
5656
#
57-
# Concourse doesn't set any environment variables to help us automate
58-
# things. In rabbitmq-ci, we run tests under the `concourse` user so,
59-
# look at that...
57+
# On CI, set $RABBITMQ_CT_SKIP_AS_ERROR so that any skipped
58+
# testsuite/testgroup/testcase is considered an error.
59+
6060
CT_QUIET_FLAGS = -verbosity 50 \
6161
-erl_args \
6262
-kernel error_logger silent
63+
6364
ifdef TRAVIS
6465
CT_OPTS += $(CT_QUIET_FLAGS)
66+
export RABBITMQ_CT_SKIP_AS_ERROR = true
6567
endif
6668
ifdef CONCOURSE
6769
CT_OPTS += $(CT_QUIET_FLAGS)
70+
export RABBITMQ_CT_SKIP_AS_ERROR = true
6871
endif
6972

7073
# Enable JUnit-like report on Jenkins. Jenkins parses those reports so
7174
# the results can be browsed from its UI. Furthermore, it displays a
7275
# graph showing evolution of the results over time.
7376
ifdef JENKINS_HOME
7477
CT_OPTS += -ct_hooks cth_surefire
78+
export RABBITMQ_CT_SKIP_AS_ERROR = true
79+
endif
80+
81+
# --------------------------------------------------------------------
82+
# Hex.pm.
83+
# --------------------------------------------------------------------
84+
85+
.PHONY: hex-publish hex-publish-docs
86+
87+
HEXPM_URL = file:///home/dumbbell/Projects/pivotal/other-repos/hexpm-cli/hexpm
88+
HEXPM_CLI = $(ERLANG_MK_TMP)/hexpm
89+
90+
$(HEXPM_CLI):
91+
$(gen_verbose) $(call core_http_get,$@,$(HEXPM_URL))
92+
$(verbose) chmod +x $@
93+
94+
rebar.config: dep_rabbit_common = hex $(PROJECT_VERSION)
95+
rebar.config: dep_amqp_client = hex $(PROJECT_VERSION)
96+
97+
define RABBITMQ_HEXPM_DEFAULT_FILES
98+
"erlang.mk",
99+
"git-revisions.txt",
100+
"include",
101+
"LICENSE*",
102+
"Makefile",
103+
"rabbitmq-components.mk",
104+
"README",
105+
"README.md",
106+
"src"
107+
endef
108+
109+
hex-publish: $(HEXPM_CLI) app rebar.config
110+
$(gen_verbose) echo "$(PROJECT_DESCRIPTION) $(PROJECT_VERSION)" \
111+
> git-revisions.txt
112+
ifneq ($(PROJECT),rabbit_common)
113+
$(verbose) mv rabbitmq-components.mk rabbitmq-components.mk.not-hexpm
114+
$(verbose) cp \
115+
$(DEPS_DIR)/rabbit_common/mk/rabbitmq-components.hexpm.mk \
116+
rabbitmq-components.mk
117+
$(verbose) touch -r rabbitmq-components.mk.not-hexpm \
118+
rabbitmq-components.mk
75119
endif
120+
$(verbose) trap '\
121+
rm -f git-revisions.txt rebar.lock; \
122+
if test -f rabbitmq-components.mk.not-hexpm; then \
123+
mv rabbitmq-components.mk.not-hexpm rabbitmq-components.mk; \
124+
fi' EXIT INT; \
125+
$(HEXPM_CLI) publish
126+
127+
hex-publish-docs: $(HEXPM_CLI) app docs
128+
$(gen_verbose) trap 'rm -f rebar.lock' EXIT INT; \
129+
$(HEXPM_CLI) docs

mk/rabbitmq-components.hexpm.mk

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
ifeq ($(.DEFAULT_GOAL),)
2+
# Define default goal to `all` because this file defines some targets
3+
# before the inclusion of erlang.mk leading to the wrong target becoming
4+
# the default.
5+
.DEFAULT_GOAL = all
6+
endif
7+
8+
# PROJECT_VERSION defaults to:
9+
# 1. the version exported by rabbitmq-server-release;
10+
# 2. the version stored in `git-revisions.txt`, if it exists;
11+
# 3. a version based on git-describe(1), if it is a Git clone;
12+
# 4. 0.0.0
13+
14+
PROJECT_VERSION := $(RABBITMQ_VERSION)
15+
16+
ifeq ($(PROJECT_VERSION),)
17+
PROJECT_VERSION := $(shell \
18+
if test -f git-revisions.txt; then \
19+
head -n1 git-revisions.txt | \
20+
awk '{print $$$(words $(PROJECT_DESCRIPTION) version);}'; \
21+
else \
22+
(git describe --dirty --abbrev=7 --tags --always --first-parent \
23+
2>/dev/null || echo rabbitmq_v0_0_0) | \
24+
sed -e 's/^rabbitmq_v//' -e 's/^v//' -e 's/_/./g' -e 's/-/+/' \
25+
-e 's/-/./g'; \
26+
fi)
27+
endif
28+
29+
# --------------------------------------------------------------------
30+
# RabbitMQ components.
31+
# --------------------------------------------------------------------
32+
33+
dep_amqp_client = hex $(PROJECT_VERSION)
34+
dep_rabbit_common = hex $(PROJECT_VERSION)
35+
36+
# Third-party dependencies version pinning.
37+
#
38+
# We do that in this file, which is copied in all projects, to ensure
39+
# all projects use the same versions. It avoids conflicts and makes it
40+
# possible to work with rabbitmq-public-umbrella.
41+
42+
dep_cowboy = hex 1.0.4
43+
dep_ranch = hex 1.3.0

mk/rabbitmq-components.mk

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ ifeq ($(.DEFAULT_GOAL),)
55
.DEFAULT_GOAL = all
66
endif
77

8+
# PROJECT_VERSION defaults to:
9+
# 1. the version exported by rabbitmq-server-release;
10+
# 2. the version stored in `git-revisions.txt`, if it exists;
11+
# 3. a version based on git-describe(1), if it is a Git clone;
12+
# 4. 0.0.0
13+
14+
PROJECT_VERSION := $(RABBITMQ_VERSION)
15+
16+
ifeq ($(PROJECT_VERSION),)
17+
PROJECT_VERSION := $(shell \
18+
if test -f git-revisions.txt; then \
19+
head -n1 git-revisions.txt | \
20+
awk '{print $$$(words $(PROJECT_DESCRIPTION) version);}'; \
21+
else \
22+
(git describe --dirty --abbrev=7 --tags --always --first-parent \
23+
2>/dev/null || echo rabbitmq_v0_0_0) | \
24+
sed -e 's/^rabbitmq_v//' -e 's/^v//' -e 's/_/./g' -e 's/-/+/' \
25+
-e 's/-/./g'; \
26+
fi)
27+
endif
28+
829
# --------------------------------------------------------------------
930
# RabbitMQ components.
1031
# --------------------------------------------------------------------

0 commit comments

Comments
 (0)