Skip to content

Commit ad215a1

Browse files
authored
OTP27 compatibility for v3.13.x specific stuff (#11623)
* quote 'maybe' * bump erlang.mk
1 parent f0bcef4 commit ad215a1

File tree

3 files changed

+46
-41
lines changed

3 files changed

+46
-41
lines changed

deps/amqp10_client/src/amqp10_msg.erl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
-include_lib("amqp10_common/include/amqp10_framing.hrl").
4040

41-
-type maybe(T) :: T | undefined.
41+
-type 'maybe'(T) :: T | undefined.
4242

4343
-type delivery_tag() :: binary().
4444
-type content_type() :: term(). % TODO: refine
@@ -52,23 +52,23 @@
5252

5353
-type amqp10_header() :: #{durable => boolean(), % false
5454
priority => byte(), % 4
55-
ttl => maybe(non_neg_integer()),
55+
ttl => 'maybe'(non_neg_integer()),
5656
first_acquirer => boolean(), % false
5757
delivery_count => non_neg_integer()}. % 0
5858

59-
-type amqp10_properties() :: #{message_id => maybe(any()),
60-
user_id => maybe(binary()),
61-
to => maybe(any()),
62-
subject => maybe(binary()),
63-
reply_to => maybe(any()),
64-
correlation_id => maybe(any()),
65-
content_type => maybe(content_type()),
66-
content_encoding => maybe(content_encoding()),
67-
absolute_expiry_time => maybe(non_neg_integer()),
68-
creation_time => maybe(non_neg_integer()),
69-
group_id => maybe(binary()),
70-
group_sequence => maybe(non_neg_integer()),
71-
reply_to_group_id => maybe(binary())}.
59+
-type amqp10_properties() :: #{message_id => 'maybe'(any()),
60+
user_id => 'maybe'(binary()),
61+
to => 'maybe'(any()),
62+
subject => 'maybe'(binary()),
63+
reply_to => 'maybe'(any()),
64+
correlation_id => 'maybe'(any()),
65+
content_type => 'maybe'(content_type()),
66+
content_encoding => 'maybe'(content_encoding()),
67+
absolute_expiry_time => 'maybe'(non_neg_integer()),
68+
creation_time => 'maybe'(non_neg_integer()),
69+
group_id => 'maybe'(binary()),
70+
group_sequence => 'maybe'(non_neg_integer()),
71+
reply_to_group_id => 'maybe'(binary())}.
7272

7373
-type amqp10_body() :: [#'v1_0.data'{}] |
7474
[#'v1_0.amqp_sequence'{}] |
@@ -78,13 +78,13 @@
7878

7979
-record(amqp10_msg,
8080
{transfer :: #'v1_0.transfer'{},
81-
header :: maybe(#'v1_0.header'{}),
82-
delivery_annotations :: maybe(#'v1_0.delivery_annotations'{}),
83-
message_annotations :: maybe(#'v1_0.message_annotations'{}),
84-
properties :: maybe(#'v1_0.properties'{}),
85-
application_properties :: maybe(#'v1_0.application_properties'{}),
81+
header :: 'maybe'(#'v1_0.header'{}),
82+
delivery_annotations :: 'maybe'(#'v1_0.delivery_annotations'{}),
83+
message_annotations :: 'maybe'(#'v1_0.message_annotations'{}),
84+
properties :: 'maybe'(#'v1_0.properties'{}),
85+
application_properties :: 'maybe'(#'v1_0.application_properties'{}),
8686
body :: amqp10_body() | unset,
87-
footer :: maybe(#'v1_0.footer'{})
87+
footer :: 'maybe'(#'v1_0.footer'{})
8888
}).
8989

9090
-opaque amqp10_msg() :: #amqp10_msg{}.
@@ -142,7 +142,7 @@ settled(#amqp10_msg{transfer = #'v1_0.transfer'{settled = Settled}}) ->
142142
% the last 1 octet is the version
143143
% See 2.8.11 in the spec
144144
-spec message_format(amqp10_msg()) ->
145-
maybe({non_neg_integer(), non_neg_integer()}).
145+
'maybe'({non_neg_integer(), non_neg_integer()}).
146146
message_format(#amqp10_msg{transfer =
147147
#'v1_0.transfer'{message_format = undefined}}) ->
148148
undefined;

deps/rabbit/src/rabbit_msg_record.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
-include_lib("rabbit_common/include/rabbit_framing.hrl").
1616
-include_lib("amqp10_common/include/amqp10_framing.hrl").
1717

18-
-type maybe(T) :: T | undefined.
18+
-type 'maybe'(T) :: T | undefined.
1919
-type amqp10_data() :: #'v1_0.data'{} |
2020
[#'v1_0.amqp_sequence'{} | #'v1_0.data'{}] |
2121
#'v1_0.amqp_value'{}.
2222
-record(msg,
2323
{
24-
% header :: maybe(#'v1_0.header'{}),
25-
% delivery_annotations :: maybe(#'v1_0.delivery_annotations'{}),
26-
message_annotations :: maybe(#'v1_0.message_annotations'{}) | iodata(),
27-
properties :: maybe(#'v1_0.properties'{}) | iodata(),
28-
application_properties :: maybe(#'v1_0.application_properties'{}) | iodata(),
29-
data :: maybe(amqp10_data()) | iodata()
30-
% footer :: maybe(#'v1_0.footer'{})
24+
% header :: 'maybe'(#'v1_0.header'{}),
25+
% delivery_annotations :: 'maybe'(#'v1_0.delivery_annotations'{}),
26+
message_annotations :: 'maybe'(#'v1_0.message_annotations'{}) | iodata(),
27+
properties :: 'maybe'(#'v1_0.properties'{}) | iodata(),
28+
application_properties :: 'maybe'(#'v1_0.application_properties'{}) | iodata(),
29+
data :: 'maybe'(amqp10_data()) | iodata()
30+
% footer :: 'maybe'(#'v1_0.footer'{})
3131
}).
3232

3333
%% holds static or rarely changing fields

erlang.mk

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))
1818
export ERLANG_MK_FILENAME
1919

20-
ERLANG_MK_VERSION = 04c473a
20+
ERLANG_MK_VERSION = b8a27ab
2121
ERLANG_MK_WITHOUT =
2222

2323
# Make 3.81 and 3.82 are deprecated.
@@ -184,8 +184,9 @@ core_http_get = curl -Lf$(if $(filter-out 0,$(V)),,s)o $(call core_native_path,$
184184

185185
core_eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
186186

187-
# We skip files that contain spaces or '#' because they end up causing issues.
188-
core_find = $(if $(wildcard $1),$(shell find $(1:%/=%) \( -type l -o -type f \) -name $(subst *,\*,$2) -not -name "*[ \#]*"))
187+
# We skip files that contain spaces because they end up causing issues.
188+
# Files that begin with a dot are already ignored by the wildcard function.
189+
core_find = $(foreach f,$(wildcard $(1:%/=%)/*),$(if $(wildcard $f/.),$(call core_find,$f,$2),$(if $(filter $(subst *,%,$2),$f),$(if $(wildcard $f),$f))))
189190

190191
core_lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1)))))))))))))))))))))))))))
191192

@@ -3564,8 +3565,10 @@ export DEPS_DIR
35643565
REBAR_DEPS_DIR = $(DEPS_DIR)
35653566
export REBAR_DEPS_DIR
35663567

3568+
# When testing Erlang.mk and updating these, make sure
3569+
# to delete test/test_rebar_git before running tests again.
35673570
REBAR3_GIT ?= https://github.com/erlang/rebar3
3568-
REBAR3_COMMIT ?= 3f563feaf1091a1980241adefa83a32dd2eebf7c # 3.20.0
3571+
REBAR3_COMMIT ?= bde4b54248d16280b2c70a244aca3bb7566e2033 # 3.23.0
35693572

35703573
CACHE_DEPS ?= 0
35713574

@@ -4018,7 +4021,7 @@ define dep_autopatch_rebar.erl
40184021
false -> ok;
40194022
{_, Files0} ->
40204023
Files = [begin
4021-
hd(filelib:wildcard("$(call core_native_path,$(DEPS_DIR)/$1/src/**/" ++ filename:rootname(F) ++ ".*rl")))
4024+
hd(filelib:wildcard("$(call core_native_path,$(DEPS_DIR)/$1/src/)**/" ++ filename:rootname(F) ++ ".*rl"))
40224025
end || "src/" ++ F <- Files0],
40234026
Names = [[" ", case lists:reverse(F) of
40244027
"lre." ++ Elif -> lists:reverse(Elif);
@@ -4147,8 +4150,8 @@ define dep_autopatch_rebar.erl
41474150
"\t$$\(CC) -o $$\@ $$\? $$\(LDFLAGS) $$\(ERL_LDFLAGS) $$\(DRV_LDFLAGS) $$\(LDLIBS) $$\(EXE_LDFLAGS)",
41484151
case {filename:extension(Output), $(PLATFORM)} of
41494152
{[], _} -> "\n";
4150-
{".so", darwin} -> "-shared\n";
4151-
{".dylib", darwin} -> "-shared\n";
4153+
{".so", darwin} -> " -shared\n";
4154+
{".dylib", darwin} -> " -shared\n";
41524155
{_, darwin} -> "\n";
41534156
_ -> " -shared\n"
41544157
end])
@@ -4665,7 +4668,6 @@ define makedep.erl
46654668
end,
46664669
MakeDepend = fun
46674670
(F, Fd, Mod, StartLocation) ->
4668-
{ok, Filename} = file:pid2name(Fd),
46694671
case io:parse_erl_form(Fd, undefined, StartLocation) of
46704672
{ok, AbsData, EndLocation} ->
46714673
case AbsData of
@@ -5493,7 +5495,7 @@ endif
54935495
$(verbose) mkdir config/
54945496
$(verbose) $(call core_render,bs_sys_config,config/sys.config)
54955497
$(verbose) $(call core_render,bs_vm_args,config/vm.args)
5496-
$(verbose) awk '/^include erlang.mk/ && !ins {print "BUILD_DEPS += relx";ins=1};{print}' Makefile > Makefile.bak
5498+
$(verbose) awk '/^include erlang.mk/ && !ins {print "REL_DEPS += relx";ins=1};{print}' Makefile > Makefile.bak
54975499
$(verbose) mv Makefile.bak Makefile
54985500

54995501
new-app:
@@ -5838,7 +5840,7 @@ else
58385840

58395841
ci:: $(addprefix ci-,$(CI_OTP))
58405842

5841-
ci-prepare: $(addprefix $(KERL_INSTALL_DIR)/,$(CI_OTP))
5843+
ci-prepare: $(addprefix ci-prepare-,$(CI_OTP))
58425844

58435845
ci-setup::
58445846
$(verbose) :
@@ -5850,7 +5852,10 @@ ci_verbose_0 = @echo " CI " $(1);
58505852
ci_verbose = $(ci_verbose_$(V))
58515853

58525854
define ci_target
5853-
ci-$1: $(KERL_INSTALL_DIR)/$2
5855+
ci-prepare-$1: $(KERL_INSTALL_DIR)/$2
5856+
$(verbose) :
5857+
5858+
ci-$1: ci-prepare-$1
58545859
$(verbose) $(MAKE) --no-print-directory clean
58555860
$(ci_verbose) \
58565861
PATH="$(KERL_INSTALL_DIR)/$2/bin:$(PATH)" \

0 commit comments

Comments
 (0)