@@ -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,
@@ -84,54 +76,6 @@ ifdef PLUGINS
8476RABBITMQ_ENABLED_PLUGINS ?= $(call comma_list,$(PLUGINS ) )
8577endif
8678
87- # --------------------------------------------------------------------
88- # Mix Hex cache management.
89- # --------------------------------------------------------------------
90-
91- # We restore the initial Hex cache.ets file from an Erlang term created
92- # at the time the source archive was prepared.
93- #
94- # See the `$(SOURCE_DIST)` recipe for the reason behind this step.
95-
96- restore-hex-cache-ets-file : deps/.hex/cache.ets
97-
98- deps/.hex/cache.ets : deps/.hex/cache.erl
99- $(gen_verbose ) $(call erlang,$(call restore_hex_cache_from_erl_term,$< ,$@ ) )
100-
101- define restore_hex_cache_from_erl_term
102- In = "$(1 ) ",
103- Out = "$(2 ) ",
104- {ok, [Props, Entries]} = file:consult(In),
105- Name = proplists:get_value(name, Props),
106- Type = proplists:get_value(type, Props),
107- Access = proplists:get_value(protection, Props),
108- NamedTable = proplists:get_bool(named_table, Props),
109- Keypos = proplists:get_value(keypos, Props),
110- Heir = proplists:get_value(heir, Props),
111- ReadConc = proplists:get_bool(read_concurrency, Props),
112- WriteConc = proplists:get_bool(write_concurrency, Props),
113- Compressed = proplists:get_bool(compressed, Props),
114- Options0 = [
115- Type,
116- Access,
117- {keypos, Keypos},
118- {heir, Heir},
119- {read_concurrency, ReadConc},
120- {write_concurrency, WriteConc}],
121- Options1 = case NamedTable of
122- true -> [named_table | Options0];
123- false -> Options0
124- end,
125- Options2 = case Compressed of
126- true -> [compressed | Options0];
127- false -> Options0
128- end,
129- Tab = ets:new(Name, Options2),
130- [true = ets:insert(Tab, Entry) || Entry <- Entries],
131- ok = ets:tab2file(Tab, Out),
132- init:stop().
133- endef
134-
13579# --------------------------------------------------------------------
13680# Distribution - common variables and generic functions.
13781# --------------------------------------------------------------------
@@ -263,14 +207,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
263207 sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$$$|include ../../erlang.mk|" \
264208 $$@ /deps/$$$$(basename $$$$dep) /Makefile && \
265209 rm $$@ /deps/$$$$(basename $$$$dep) /Makefile.bak; \
266- mix_exs=$$@ /deps/$$$$(basename $$$$dep) /mix.exs; \
267- if test -f $$$$mix_exs; then \
268- (cd $$$$(dirname "$$$$mix_exs" ) && \
269- (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) && \
270- env DEPS_DIR=$$@ /deps MIX_HOME=$$@ /deps/.mix HEX_HOME=$$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix deps.get --only prod && \
271- cp $(CURDIR ) /mk/rabbitmq-mix.mk . && \
272- rm -rf _build deps); \
273- fi; \
274210 if test -f "$$$$dep/license_info"; then \
275211 cp "$$$$dep/license_info" "$$@ /deps/licensing/license_info_$$$$(basename $$$$dep) "; \
276212 cat "$$$$dep/license_info" >> $$@ /LICENSE; \
@@ -295,7 +231,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
295231 done
296232 $${verbose} echo "PLUGINS := $(PLUGINS ) " > $$@ /plugins.mk
297233 $${verbose} sort -r < "$$@ .git-times.txt" | head -n 1 > "$$@ .git-time.txt"
298- $${verbose} $$(call erlang,$$(call dump_hex_cache_to_erl_term,$$(call core_native_path,$$@ ) ,$$(call core_native_path,$$@ .git-time.txt) ) )
299234 $${verbose} find $$@ -print0 | xargs -0 touch -t "$$$$(cat $$@ .git-time.txt ) "
300235 $${verbose} rm "$$@ .git-times.txt" "$$@ .git-time.txt"
301236
@@ -337,47 +272,6 @@ clean-$(1):
337272clean:: clean-$(1 )
338273endef
339274
340- # Mix Hex component requires a cache file, otherwise it refuses to build
341- # offline... That cache is an ETS table with all the applications we
342- # depend on, plus some versioning informations and checksums. There
343- # are two problems with that: the table contains a date (`last_update`
344- # field) and `ets:tab2file()` produces a different file each time it's
345- # called.
346- #
347- # To make our source archive reproducible, we fix the time of the
348- # `last_update` field to the last Git commit and dump the content of the
349- # table as an Erlang term to a text file.
350- #
351- # The ETS file must be recreated before compiling RabbitMQ. See the
352- # `restore-hex-cache-ets-file` Make target.
353- define dump_hex_cache_to_erl_term
354- In = "$(1 ) /deps/.hex/cache.ets",
355- Out = "$(1 ) /deps/.hex/cache.erl",
356- {ok, DateStr} = file:read_file("$(2 ) "),
357- {match, Date} = re:run(DateStr,
358- "^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\.([0-9]{2})",
359- [{capture, all_but_first, list}]),
360- [Year, Month, Day, Hour, Min, Sec] = [erlang:list_to_integer(V) || V <- Date],
361- {ok, Tab} = ets:file2tab(In),
362- true = ets:insert(Tab, {last_update, {{Year, Month, Day}, {Hour, Min, Sec}}}),
363- Props = [
364- Prop
365- || {Key, _} = Prop <- ets:info(Tab),
366- Key =:= name orelse
367- Key =:= type orelse
368- Key =:= protection orelse
369- Key =:= named_table orelse
370- Key =:= keypos orelse
371- Key =:= heir orelse
372- Key =:= read_concurrency orelse
373- Key =:= write_concurrency orelse
374- Key =:= compressed],
375- Entries = ets:tab2list(Tab),
376- ok = file:write_file(Out, io_lib:format("~w.~n~w.~n", [Props, Entries])),
377- ok = file:delete(In),
378- init:stop().
379- endef
380-
381275# --------------------------------------------------------------------
382276# Distribution - public targets
383277# --------------------------------------------------------------------
0 commit comments