Skip to content

Commit b6fe1b6

Browse files
Merge pull request #8204 from rabbitmq/rin/fixup-offline-source-dist
Fix offline `make dist`
2 parents e290acb + 0be657e commit b6fe1b6

File tree

1 file changed

+4
-56
lines changed

1 file changed

+4
-56
lines changed

deps/rabbit_common/mk/rabbitmq-dist.mk

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ dist_verbose_0 = @echo " DIST " $@;
1717
dist_verbose_2 = set -x;
1818
dist_verbose = $(dist_verbose_$(V))
1919

20-
MIX_ARCHIVES ?= $(HOME)/.mix/archives
21-
22-
MIX_TASK_ARCHIVE_DEPS_VERSION = 1.0.0
23-
MIX_TASK_ARCHIVE_DEPS_SHA512 = 6947124c0848d0584416251fc31335d8c17ecd3dbcf8c4013a9c1f0df7a31d16b790dfc1cb45721624fb77610e31975b6804771fe5268797740002bf54c789b8
24-
mix_task_archive_deps = $(MIX_ARCHIVES)/mix_task_archive_deps-$(MIX_TASK_ARCHIVE_DEPS_VERSION)
25-
2620
# We take the version of an Erlang application from the .app file. This
2721
# macro is called like this:
2822
#
@@ -45,12 +39,6 @@ $(shell awk '
4539
}' $(1))
4640
endef
4741

48-
define get_mix_project_version
49-
$(shell cd $(1) && \
50-
$(MIX) do deps.get, deps.compile, compile >/dev/null && \
51-
$(MIX) run --no-start -e "IO.puts(Mix.Project.config[:version])")
52-
endef
53-
5442
# Define the target to create an .ez plugin archive for an
5543
# Erlang.mk-based project. This macro is called like this:
5644
#
@@ -91,40 +79,12 @@ ERLANGMK_DIST_EZS += $$(dist_$(1)_ez)
9179

9280
endef
9381

94-
# Define the target to create an .ez plugin archive for a Mix-based
95-
# project. This macro is called like this:
96-
#
97-
# $(call do_ez_target_mix,app_name,app_version,app_dir)
98-
99-
define get_mix_project_dep_ezs
100-
$(shell cd $(1) && \
101-
$(MIX) do deps.get, deps.compile, compile >/dev/null && \
102-
$(MIX) archive.build.all.list -e -o $(DIST_DIR) --skip "rabbit $(ERLANGMK_DIST_APPS)")
103-
endef
104-
105-
define do_ez_target_mix
106-
dist_$(1)_ez_dir = $$(if $(2),$(DIST_DIR)/$(1)-$(2), \
107-
$$(if $$(VERSION),$(DIST_DIR)/$(1)-$$(VERSION),$(DIST_DIR)/$(1)))
108-
dist_$(1)_ez = $$(dist_$(1)_ez_dir).ez
109-
110-
$$(dist_$(1)_ez): APP = $(1)
111-
$$(dist_$(1)_ez): VSN = $(2)
112-
$$(dist_$(1)_ez): SRC_DIR = $(3)
113-
$$(dist_$(1)_ez): EZ_DIR = $$(abspath $$(dist_$(1)_ez_dir))
114-
$$(dist_$(1)_ez): EZ = $$(dist_$(1)_ez)
115-
$$(dist_$(1)_ez): $$(if $$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),\
116-
$$(filter-out %/dep_built,$$(call core_find,$$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),*)),)
117-
118-
MIX_DIST_EZS += $$(dist_$(1)_ez)
119-
EXTRA_DIST_EZS += $$(call get_mix_project_dep_ezs,$(3))
120-
121-
endef
122-
12382
# Real entry point: it tests the existence of an .app file to determine
12483
# if it is an Erlang application (and therefore if it should be provided
12584
# as an .ez plugin archive) and calls do_ez_target_erlangmk. If instead
126-
# it finds a Mix configuration file, it calls do_ez_target_mix. It
127-
# should be called as:
85+
# it finds a Mix configuration file, it is skipped, as the only elixir
86+
# applications in the directory are used by rabbitmq_cli and compiled
87+
# with it.
12888
#
12989
# $(call ez_target,path_to_app)
13090

@@ -134,9 +94,7 @@ dist_$(1)_appfile = $$(dist_$(1)_appdir)/ebin/$(1).app
13494
dist_$(1)_mixfile = $$(dist_$(1)_appdir)/mix.exs
13595

13696
$$(if $$(shell test -f $$(dist_$(1)_appfile) && echo OK), \
137-
$$(eval $$(call do_ez_target_erlangmk,$(1),$$(call get_app_version,$$(dist_$(1)_appfile)),$$(dist_$(1)_appdir))), \
138-
$$(if $$(shell test -f $$(dist_$(1)_mixfile) && [ "x$(1)" != "xrabbitmqctl" ] && [ "x$(1)" != "xrabbitmq_cli" ] && echo OK), \
139-
$$(eval $$(call do_ez_target_mix,$(1),$$(call get_mix_project_version,$$(dist_$(1)_appdir)),$$(dist_$(1)_appdir)))))
97+
$$(eval $$(call do_ez_target_erlangmk,$(1),$$(call get_app_version,$$(dist_$(1)_appfile)),$$(dist_$(1)_appdir))))
14098

14199
endef
142100

@@ -202,16 +160,6 @@ ifneq ($(DIST_AS_EZS),)
202160
$(verbose) rm -rf $(EZ_DIR) $(EZ_DIR).manifest
203161
endif
204162

205-
$(MIX_DIST_EZS): $(mix_task_archive_deps)
206-
$(verbose) cd $(SRC_DIR) && \
207-
$(MIX) do deps.get, deps.compile, compile, archive.build.all \
208-
-e -o $(abspath $(DIST_DIR)) --skip "rabbit $(ERLANGMK_DIST_APPS)"
209-
210-
MIX_TASK_ARCHIVE_DEPS_URL = https://github.com/rabbitmq/mix_task_archive_deps/releases/download/$(MIX_TASK_ARCHIVE_DEPS_VERSION)/mix_task_archive_deps-$(MIX_TASK_ARCHIVE_DEPS_VERSION).ez
211-
212-
$(mix_task_archive_deps):
213-
$(gen_verbose) mix archive.install --force --sha512 $(MIX_TASK_ARCHIVE_DEPS_SHA512) $(MIX_TASK_ARCHIVE_DEPS_URL)
214-
215163
# We need to recurse because the top-level make instance is evaluated
216164
# before dependencies are downloaded.
217165

0 commit comments

Comments
 (0)