@@ -31,10 +31,6 @@ DISABLE_DISTCLEAN = 1
3131ifeq ($(filter-out xref,$(MAKECMDGOALS ) ) ,)
3232XREF_SCOPE = app deps
3333
34- # We add all the applications that are in non-standard paths
35- # so they are included in the analyses as well.
36- XREF_EXTRA_APP_DIRS = $(filter-out deps/rabbitmq_cli/_build/dev/lib/rabbit_common/,$(wildcard deps/rabbitmq_cli/_build/dev/lib/* /) ) deps/rabbitmq_prelaunch/
37-
3834# For Elixir protocols the right fix is to include the consolidated/
3935# folders in addition to ebin/. However this creates conflicts because
4036# some modules are duplicated. So instead we ignore warnings from
@@ -49,10 +45,6 @@ XREF_IGNORE = [ \
4945xref : ERL_LIBS := $(ERL_LIBS ) :$(CURDIR ) /apps:$(CURDIR ) /deps:$(dir $(shell elixir --eval ':io.format "~s~n", [:code.lib_dir :elixir ]') )
5046endif
5147
52- ifneq ($(wildcard deps/.hex/cache.erl) ,)
53- deps :: restore-hex-cache-ets-file
54- endif
55-
5648include rabbitmq-components.mk
5749
5850# Set PROJECT_VERSION, calculated in rabbitmq-components.mk,
@@ -85,54 +77,6 @@ ifdef PLUGINS
8577RABBITMQ_ENABLED_PLUGINS ?= $(call comma_list,$(PLUGINS ) )
8678endif
8779
88- # --------------------------------------------------------------------
89- # Mix Hex cache management.
90- # --------------------------------------------------------------------
91-
92- # We restore the initial Hex cache.ets file from an Erlang term created
93- # at the time the source archive was prepared.
94- #
95- # See the `$(SOURCE_DIST)` recipe for the reason behind this step.
96-
97- restore-hex-cache-ets-file : deps/.hex/cache.ets
98-
99- deps/.hex/cache.ets : deps/.hex/cache.erl
100- $(gen_verbose ) $(call erlang,$(call restore_hex_cache_from_erl_term,$< ,$@ ) )
101-
102- define restore_hex_cache_from_erl_term
103- In = "$(1 ) ",
104- Out = "$(2 ) ",
105- {ok, [Props, Entries]} = file:consult(In),
106- Name = proplists:get_value(name, Props),
107- Type = proplists:get_value(type, Props),
108- Access = proplists:get_value(protection, Props),
109- NamedTable = proplists:get_bool(named_table, Props),
110- Keypos = proplists:get_value(keypos, Props),
111- Heir = proplists:get_value(heir, Props),
112- ReadConc = proplists:get_bool(read_concurrency, Props),
113- WriteConc = proplists:get_bool(write_concurrency, Props),
114- Compressed = proplists:get_bool(compressed, Props),
115- Options0 = [
116- Type,
117- Access,
118- {keypos, Keypos},
119- {heir, Heir},
120- {read_concurrency, ReadConc},
121- {write_concurrency, WriteConc}],
122- Options1 = case NamedTable of
123- true -> [named_table | Options0];
124- false -> Options0
125- end,
126- Options2 = case Compressed of
127- true -> [compressed | Options0];
128- false -> Options0
129- end,
130- Tab = ets:new(Name, Options2),
131- [true = ets:insert(Tab, Entry) || Entry <- Entries],
132- ok = ets:tab2file(Tab, Out),
133- init:stop().
134- endef
135-
13680# --------------------------------------------------------------------
13781# Distribution - common variables and generic functions.
13882# --------------------------------------------------------------------
@@ -270,14 +214,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
270214 sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$$$|include ../../erlang.mk|" \
271215 $$@ /deps/$$$$(basename $$$$dep) /Makefile && \
272216 rm $$@ /deps/$$$$(basename $$$$dep) /Makefile.bak; \
273- mix_exs=$$@ /deps/$$$$(basename $$$$dep) /mix.exs; \
274- if test -f $$$$mix_exs; then \
275- (cd $$$$(dirname "$$$$mix_exs" ) && \
276- (test -d $$@ /deps/.hex || env DEPS_DIR=$$@ /deps MIX_HOME=$$@ /deps/.mix HEX_HOME=$$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix local.hex --force) && \
277- env DEPS_DIR=$$@ /deps MIX_HOME=$$@ /deps/.mix HEX_HOME=$$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix deps.get --only prod && \
278- cp $(CURDIR ) /mk/rabbitmq-mix.mk . && \
279- rm -rf _build deps); \
280- fi; \
281217 if test -f "$$$$dep/license_info"; then \
282218 cp "$$$$dep/license_info" "$$@ /deps/licensing/license_info_$$$$(basename $$$$dep) "; \
283219 cat "$$$$dep/license_info" >> $$@ /LICENSE; \
@@ -302,7 +238,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
302238 done
303239 $${verbose} echo "PLUGINS := $(PLUGINS ) " > $$@ /plugins.mk
304240 $${verbose} sort -r < "$$@ .git-times.txt" | head -n 1 > "$$@ .git-time.txt"
305- $${verbose} $$(call erlang,$$(call dump_hex_cache_to_erl_term,$$(call core_native_path,$$@ ) ,$$(call core_native_path,$$@ .git-time.txt) ) )
306241 $${verbose} find $$@ -print0 | xargs -0 touch -t "$$$$(cat $$@ .git-time.txt ) "
307242 $${verbose} rm "$$@ .git-times.txt" "$$@ .git-time.txt"
308243
@@ -344,47 +279,6 @@ clean-$(1):
344279clean:: clean-$(1 )
345280endef
346281
347- # Mix Hex component requires a cache file, otherwise it refuses to build
348- # offline... That cache is an ETS table with all the applications we
349- # depend on, plus some versioning informations and checksums. There
350- # are two problems with that: the table contains a date (`last_update`
351- # field) and `ets:tab2file()` produces a different file each time it's
352- # called.
353- #
354- # To make our source archive reproducible, we fix the time of the
355- # `last_update` field to the last Git commit and dump the content of the
356- # table as an Erlang term to a text file.
357- #
358- # The ETS file must be recreated before compiling RabbitMQ. See the
359- # `restore-hex-cache-ets-file` Make target.
360- define dump_hex_cache_to_erl_term
361- In = "$(1 ) /deps/.hex/cache.ets",
362- Out = "$(1 ) /deps/.hex/cache.erl",
363- {ok, DateStr} = file:read_file("$(2 ) "),
364- {match, Date} = re:run(DateStr,
365- "^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\.([0-9]{2})",
366- [{capture, all_but_first, list}]),
367- [Year, Month, Day, Hour, Min, Sec] = [erlang:list_to_integer(V) || V <- Date],
368- {ok, Tab} = ets:file2tab(In),
369- true = ets:insert(Tab, {last_update, {{Year, Month, Day}, {Hour, Min, Sec}}}),
370- Props = [
371- Prop
372- || {Key, _} = Prop <- ets:info(Tab),
373- Key =:= name orelse
374- Key =:= type orelse
375- Key =:= protection orelse
376- Key =:= named_table orelse
377- Key =:= keypos orelse
378- Key =:= heir orelse
379- Key =:= read_concurrency orelse
380- Key =:= write_concurrency orelse
381- Key =:= compressed],
382- Entries = ets:tab2list(Tab),
383- ok = file:write_file(Out, io_lib:format("~w.~n~w.~n", [Props, Entries])),
384- ok = file:delete(In),
385- init:stop().
386- endef
387-
388282# --------------------------------------------------------------------
389283# Distribution - public targets
390284# --------------------------------------------------------------------
0 commit comments