From c22a46b7fa17fbe99d0cb7893738b30ee60668d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 18 Dec 2024 15:15:05 +0100 Subject: [PATCH] Cleanup mix.exs and rabbitmq_cli Makefile --- deps/rabbitmq_cli/Makefile | 48 ++++++++++++-------------------------- deps/rabbitmq_cli/mix.exs | 27 +-------------------- 2 files changed, 16 insertions(+), 59 deletions(-) diff --git a/deps/rabbitmq_cli/Makefile b/deps/rabbitmq_cli/Makefile index 59b105e9e9d..5df0597ea27 100644 --- a/deps/rabbitmq_cli/Makefile +++ b/deps/rabbitmq_cli/Makefile @@ -30,6 +30,7 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk VERBOSE_TEST ?= true MAX_CASES ?= 1 +# We are still using Mix for testing. MIX_TEST_OPTS ?= "" MIX_TEST = ERL_COMPILER_OPTIONS=deterministic MIX_ENV=test mix do compile --warnings-as-errors, test --max-cases=$(MAX_CASES) --warnings-as-errors @@ -62,33 +63,15 @@ ESCRIPT_EMU_ARGS += -hidden escript-zip:: $(verbose) $(ESCRIPT_ZIP) $(ESCRIPT_ZIP_FILE) $(ELIXIR_LIBS)/* - -# rabbitmq-mix.mk is generated during the creation of the RabbitMQ -# source archive. It sets some environment variables to allow -# rabbitmq_cli to build offline, using the bundled sources only. --include rabbitmq-mix.mk - -ACTUAL_ESCRIPTS = $(ESCRIPT_FILE) - LINKED_ESCRIPTS = escript/rabbitmq-plugins \ - escript/rabbitmq-diagnostics \ - escript/rabbitmq-queues \ - escript/rabbitmq-streams \ - escript/vmware-rabbitmq \ - escript/rabbitmq-upgrade + escript/rabbitmq-diagnostics \ + escript/rabbitmq-queues \ + escript/rabbitmq-streams \ + escript/vmware-rabbitmq \ + escript/rabbitmq-upgrade escript:: $(LINKED_ESCRIPTS) -# Record the build and link dependency: the target files are linked to -# their first dependency. -rabbitmq-plugins = escript/rabbitmqctl -rabbitmq-diagnostics = escript/rabbitmqctl -rabbitmq-queues = escript/rabbitmqctl -rabbitmq-streams = escript/rabbitmqctl -rabbitmq-upgrade = escript/rabbitmqctl -vmware-rabbitmq = escript/rabbitmqctl -escript/rabbitmq-plugins escript/rabbitmq-diagnostics escript/rabbitmq-queues escript/rabbitmq-streams escript/rabbitmq-upgrade escript/vmware-rabbitmq: escript/rabbitmqctl - # We use hardlinks or symlinks in the `escript` directory and # install's PREFIX when a single escript can have several names (eg. # rabbitmq-plugins, rabbitmq-plugins and rabbitmq-diagnostics). @@ -109,10 +92,9 @@ else link_escript = ln -f "$(dir $(2))$(notdir $(1))" "$(2)" endif -# Elixir dependencies are fetched and compiled as part of the alias -# `mix make_all`. We do not fetch and build them in `make deps` because -# mix(1) startup time is quite high. Thus we prefer to run it once, even -# though it kind of breaks the Erlang.mk model. +# Erlang.mk will fetch dependencies as it now has native Elixir support. +# However we are still using Mix for tests and this means Mix will fetch +# test dependencies. # # We write `y` on mix stdin because it asks approval to install Hex if # it's missing. Another way to do it is to use `mix local.hex` but it @@ -127,7 +109,7 @@ endif # otherwise mix(1) complains about missing dependencies (the non-prod # ones). -$(LINKED_ESCRIPTS): +$(LINKED_ESCRIPTS): $(ESCRIPT_FILE) $(verbose) rm -f "$@" $(gen_verbose) $(call link_escript,$<,$@) @@ -160,11 +142,11 @@ dialyzer:: escript install: $(ESCRIPT_FILE) ifdef PREFIX $(gen_verbose) mkdir -p "$(DESTDIR)$(PREFIX)" - $(verbose) $(foreach script,$(ACTUAL_ESCRIPTS), \ - cmp -s "$(script)" "$(DESTDIR)$(PREFIX)/$(notdir $(script))" || \ - cp "$(script)" "$(DESTDIR)$(PREFIX)/$(notdir $(script))";) + $(verbose) \ + cmp -s "$(ESCRIPT_FILE)" "$(DESTDIR)$(PREFIX)/$(notdir $(ESCRIPT_FILE))" || \ + cp "$(ESCRIPT_FILE)" "$(DESTDIR)$(PREFIX)/$(notdir $(ESCRIPT_FILE))" $(verbose) $(foreach script,$(LINKED_ESCRIPTS), \ - $(call link_escript,$($(notdir $(script))),$(DESTDIR)$(PREFIX)/$(notdir $(script)));) + $(call link_escript,$(ESCRIPT_FILE),$(DESTDIR)$(PREFIX)/$(notdir $(script)));) else $(verbose) echo "You must specify a PREFIX" 1>&2; false endif @@ -172,7 +154,7 @@ endif clean:: clean-mix clean-mix: - $(gen_verbose) rm -f $(ACTUAL_ESCRIPTS) $(LINKED_ESCRIPTS) + $(gen_verbose) rm -f $(ESCRIPT_FILE) $(LINKED_ESCRIPTS) $(verbose) echo y | mix clean format: diff --git a/deps/rabbitmq_cli/mix.exs b/deps/rabbitmq_cli/mix.exs index 6be844f5274..0eb37a1ad90 100644 --- a/deps/rabbitmq_cli/mix.exs +++ b/deps/rabbitmq_cli/mix.exs @@ -22,7 +22,6 @@ defmodule RabbitMQCtl.MixfileBase do prune_code_paths: false, elixirc_options: [ignore_module_conflict: true], deps: deps(Mix.env()), - aliases: aliases(), xref: [ exclude: [ CSV, @@ -144,6 +143,7 @@ defmodule RabbitMQCtl.MixfileBase do fake_cmd = "true" is_bazel = System.get_env("IS_BAZEL") != nil + # Note that normal deps will be fetched by Erlang.mk on build. [ { :json, @@ -209,29 +209,4 @@ defmodule RabbitMQCtl.MixfileBase do [] end end - - defp aliases do - [ - make_deps: [ - "deps.get", - "deps.compile" - ], - make_app: [ - "compile", - "escript.build" - ], - make_all: [ - "deps.get", - "deps.compile", - "compile", - "escript.build" - ], - make_all_in_src_archive: [ - "deps.get --only prod", - "deps.compile", - "compile", - "escript.build" - ] - ] - end end