From d6ce896bdc260dd427acdd1e17b181cc0c308996 Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Tue, 16 May 2023 12:05:25 +0200 Subject: Fix offline `make dist` See #7869. #7875 resulted in elixir apps (besides the cli) in the deps dir. This triggered dormant makefile logic to compile such deps. It turns out that it's unnecessary to pre-compile them, given the cli's mix.exs file. (cherry picked from commit 0be657ee14598b505d3a4fee48489742aca0c080) --- deps/rabbit_common/mk/rabbitmq-dist.mk | 60 +++------------------------------- 1 file changed, 4 insertions(+), 56 deletions(-) diff --git a/deps/rabbit_common/mk/rabbitmq-dist.mk b/deps/rabbit_common/mk/rabbitmq-dist.mk index 978d3ddc65..35b0dda529 100644 --- a/deps/rabbit_common/mk/rabbitmq-dist.mk +++ b/deps/rabbit_common/mk/rabbitmq-dist.mk @@ -17,12 +17,6 @@ dist_verbose_0 = @echo " DIST " $@; dist_verbose_2 = set -x; dist_verbose = $(dist_verbose_$(V)) -MIX_ARCHIVES ?= $(HOME)/.mix/archives - -MIX_TASK_ARCHIVE_DEPS_VERSION = 1.0.0 -MIX_TASK_ARCHIVE_DEPS_SHA512 = 6947124c0848d0584416251fc31335d8c17ecd3dbcf8c4013a9c1f0df7a31d16b790dfc1cb45721624fb77610e31975b6804771fe5268797740002bf54c789b8 -mix_task_archive_deps = $(MIX_ARCHIVES)/mix_task_archive_deps-$(MIX_TASK_ARCHIVE_DEPS_VERSION) - # We take the version of an Erlang application from the .app file. This # macro is called like this: # @@ -45,12 +39,6 @@ $(shell awk ' }' $(1)) endef -define get_mix_project_version -$(shell cd $(1) && \ - $(MIX) do deps.get, deps.compile, compile >/dev/null && \ - $(MIX) run --no-start -e "IO.puts(Mix.Project.config[:version])") -endef - # Define the target to create an .ez plugin archive for an # Erlang.mk-based project. This macro is called like this: # @@ -91,40 +79,12 @@ ERLANGMK_DIST_EZS += $$(dist_$(1)_ez) endef -# Define the target to create an .ez plugin archive for a Mix-based -# project. This macro is called like this: -# -# $(call do_ez_target_mix,app_name,app_version,app_dir) - -define get_mix_project_dep_ezs -$(shell cd $(1) && \ - $(MIX) do deps.get, deps.compile, compile >/dev/null && \ - $(MIX) archive.build.all.list -e -o $(DIST_DIR) --skip "rabbit $(ERLANGMK_DIST_APPS)") -endef - -define do_ez_target_mix -dist_$(1)_ez_dir = $$(if $(2),$(DIST_DIR)/$(1)-$(2), \ - $$(if $$(VERSION),$(DIST_DIR)/$(1)-$$(VERSION),$(DIST_DIR)/$(1))) -dist_$(1)_ez = $$(dist_$(1)_ez_dir).ez - -$$(dist_$(1)_ez): APP = $(1) -$$(dist_$(1)_ez): VSN = $(2) -$$(dist_$(1)_ez): SRC_DIR = $(3) -$$(dist_$(1)_ez): EZ_DIR = $$(abspath $$(dist_$(1)_ez_dir)) -$$(dist_$(1)_ez): EZ = $$(dist_$(1)_ez) -$$(dist_$(1)_ez): $$(if $$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),\ - $$(filter-out %/dep_built,$$(call core_find,$$(wildcard _build/dev/lib/$(1)/ebin $(3)/priv),*)),) - -MIX_DIST_EZS += $$(dist_$(1)_ez) -EXTRA_DIST_EZS += $$(call get_mix_project_dep_ezs,$(3)) - -endef - # Real entry point: it tests the existence of an .app file to determine # if it is an Erlang application (and therefore if it should be provided # as an .ez plugin archive) and calls do_ez_target_erlangmk. If instead -# it finds a Mix configuration file, it calls do_ez_target_mix. It -# should be called as: +# it finds a Mix configuration file, it is skipped, as the only elixir +# applications in the directory are used by rabbitmq_cli and compiled +# with it. # # $(call ez_target,path_to_app) @@ -134,9 +94,7 @@ dist_$(1)_appfile = $$(dist_$(1)_appdir)/ebin/$(1).app dist_$(1)_mixfile = $$(dist_$(1)_appdir)/mix.exs $$(if $$(shell test -f $$(dist_$(1)_appfile) && echo OK), \ - $$(eval $$(call do_ez_target_erlangmk,$(1),$$(call get_app_version,$$(dist_$(1)_appfile)),$$(dist_$(1)_appdir))), \ - $$(if $$(shell test -f $$(dist_$(1)_mixfile) && [ "x$(1)" != "xrabbitmqctl" ] && [ "x$(1)" != "xrabbitmq_cli" ] && echo OK), \ - $$(eval $$(call do_ez_target_mix,$(1),$$(call get_mix_project_version,$$(dist_$(1)_appdir)),$$(dist_$(1)_appdir))))) + $$(eval $$(call do_ez_target_erlangmk,$(1),$$(call get_app_version,$$(dist_$(1)_appfile)),$$(dist_$(1)_appdir)))) endef @@ -202,16 +160,6 @@ ifneq ($(DIST_AS_EZS),) $(verbose) rm -rf $(EZ_DIR) $(EZ_DIR).manifest endif -$(MIX_DIST_EZS): $(mix_task_archive_deps) - $(verbose) cd $(SRC_DIR) && \ - $(MIX) do deps.get, deps.compile, compile, archive.build.all \ - -e -o $(abspath $(DIST_DIR)) --skip "rabbit $(ERLANGMK_DIST_APPS)" - -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 - -$(mix_task_archive_deps): - $(gen_verbose) mix archive.install --force --sha512 $(MIX_TASK_ARCHIVE_DEPS_SHA512) $(MIX_TASK_ARCHIVE_DEPS_URL) - # We need to recurse because the top-level make instance is evaluated # before dependencies are downloaded. -- cgit v1.2.1