Skip to content

Commit c22a46b

Browse files
committed
Cleanup mix.exs and rabbitmq_cli Makefile
1 parent 0090a7b commit c22a46b

File tree

2 files changed

+16
-59
lines changed

2 files changed

+16
-59
lines changed

deps/rabbitmq_cli/Makefile

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk
3030
VERBOSE_TEST ?= true
3131
MAX_CASES ?= 1
3232

33+
# We are still using Mix for testing.
3334
MIX_TEST_OPTS ?= ""
3435
MIX_TEST = ERL_COMPILER_OPTIONS=deterministic MIX_ENV=test mix do compile --warnings-as-errors, test --max-cases=$(MAX_CASES) --warnings-as-errors
3536

@@ -62,33 +63,15 @@ ESCRIPT_EMU_ARGS += -hidden
6263
escript-zip::
6364
$(verbose) $(ESCRIPT_ZIP) $(ESCRIPT_ZIP_FILE) $(ELIXIR_LIBS)/*
6465

65-
66-
# rabbitmq-mix.mk is generated during the creation of the RabbitMQ
67-
# source archive. It sets some environment variables to allow
68-
# rabbitmq_cli to build offline, using the bundled sources only.
69-
-include rabbitmq-mix.mk
70-
71-
ACTUAL_ESCRIPTS = $(ESCRIPT_FILE)
72-
7366
LINKED_ESCRIPTS = escript/rabbitmq-plugins \
74-
escript/rabbitmq-diagnostics \
75-
escript/rabbitmq-queues \
76-
escript/rabbitmq-streams \
77-
escript/vmware-rabbitmq \
78-
escript/rabbitmq-upgrade
67+
escript/rabbitmq-diagnostics \
68+
escript/rabbitmq-queues \
69+
escript/rabbitmq-streams \
70+
escript/vmware-rabbitmq \
71+
escript/rabbitmq-upgrade
7972

8073
escript:: $(LINKED_ESCRIPTS)
8174

82-
# Record the build and link dependency: the target files are linked to
83-
# their first dependency.
84-
rabbitmq-plugins = escript/rabbitmqctl
85-
rabbitmq-diagnostics = escript/rabbitmqctl
86-
rabbitmq-queues = escript/rabbitmqctl
87-
rabbitmq-streams = escript/rabbitmqctl
88-
rabbitmq-upgrade = escript/rabbitmqctl
89-
vmware-rabbitmq = escript/rabbitmqctl
90-
escript/rabbitmq-plugins escript/rabbitmq-diagnostics escript/rabbitmq-queues escript/rabbitmq-streams escript/rabbitmq-upgrade escript/vmware-rabbitmq: escript/rabbitmqctl
91-
9275
# We use hardlinks or symlinks in the `escript` directory and
9376
# install's PREFIX when a single escript can have several names (eg.
9477
# rabbitmq-plugins, rabbitmq-plugins and rabbitmq-diagnostics).
@@ -109,10 +92,9 @@ else
10992
link_escript = ln -f "$(dir $(2))$(notdir $(1))" "$(2)"
11093
endif
11194

112-
# Elixir dependencies are fetched and compiled as part of the alias
113-
# `mix make_all`. We do not fetch and build them in `make deps` because
114-
# mix(1) startup time is quite high. Thus we prefer to run it once, even
115-
# though it kind of breaks the Erlang.mk model.
95+
# Erlang.mk will fetch dependencies as it now has native Elixir support.
96+
# However we are still using Mix for tests and this means Mix will fetch
97+
# test dependencies.
11698
#
11799
# We write `y` on mix stdin because it asks approval to install Hex if
118100
# it's missing. Another way to do it is to use `mix local.hex` but it
@@ -127,7 +109,7 @@ endif
127109
# otherwise mix(1) complains about missing dependencies (the non-prod
128110
# ones).
129111

130-
$(LINKED_ESCRIPTS):
112+
$(LINKED_ESCRIPTS): $(ESCRIPT_FILE)
131113
$(verbose) rm -f "$@"
132114
$(gen_verbose) $(call link_escript,$<,$@)
133115

@@ -160,19 +142,19 @@ dialyzer:: escript
160142
install: $(ESCRIPT_FILE)
161143
ifdef PREFIX
162144
$(gen_verbose) mkdir -p "$(DESTDIR)$(PREFIX)"
163-
$(verbose) $(foreach script,$(ACTUAL_ESCRIPTS), \
164-
cmp -s "$(script)" "$(DESTDIR)$(PREFIX)/$(notdir $(script))" || \
165-
cp "$(script)" "$(DESTDIR)$(PREFIX)/$(notdir $(script))";)
145+
$(verbose) \
146+
cmp -s "$(ESCRIPT_FILE)" "$(DESTDIR)$(PREFIX)/$(notdir $(ESCRIPT_FILE))" || \
147+
cp "$(ESCRIPT_FILE)" "$(DESTDIR)$(PREFIX)/$(notdir $(ESCRIPT_FILE))"
166148
$(verbose) $(foreach script,$(LINKED_ESCRIPTS), \
167-
$(call link_escript,$($(notdir $(script))),$(DESTDIR)$(PREFIX)/$(notdir $(script)));)
149+
$(call link_escript,$(ESCRIPT_FILE),$(DESTDIR)$(PREFIX)/$(notdir $(script)));)
168150
else
169151
$(verbose) echo "You must specify a PREFIX" 1>&2; false
170152
endif
171153

172154
clean:: clean-mix
173155

174156
clean-mix:
175-
$(gen_verbose) rm -f $(ACTUAL_ESCRIPTS) $(LINKED_ESCRIPTS)
157+
$(gen_verbose) rm -f $(ESCRIPT_FILE) $(LINKED_ESCRIPTS)
176158
$(verbose) echo y | mix clean
177159

178160
format:

deps/rabbitmq_cli/mix.exs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ defmodule RabbitMQCtl.MixfileBase do
2222
prune_code_paths: false,
2323
elixirc_options: [ignore_module_conflict: true],
2424
deps: deps(Mix.env()),
25-
aliases: aliases(),
2625
xref: [
2726
exclude: [
2827
CSV,
@@ -144,6 +143,7 @@ defmodule RabbitMQCtl.MixfileBase do
144143
fake_cmd = "true"
145144
is_bazel = System.get_env("IS_BAZEL") != nil
146145

146+
# Note that normal deps will be fetched by Erlang.mk on build.
147147
[
148148
{
149149
:json,
@@ -209,29 +209,4 @@ defmodule RabbitMQCtl.MixfileBase do
209209
[]
210210
end
211211
end
212-
213-
defp aliases do
214-
[
215-
make_deps: [
216-
"deps.get",
217-
"deps.compile"
218-
],
219-
make_app: [
220-
"compile",
221-
"escript.build"
222-
],
223-
make_all: [
224-
"deps.get",
225-
"deps.compile",
226-
"compile",
227-
"escript.build"
228-
],
229-
make_all_in_src_archive: [
230-
"deps.get --only prod",
231-
"deps.compile",
232-
"compile",
233-
"escript.build"
234-
]
235-
]
236-
end
237212
end

0 commit comments

Comments
 (0)