Skip to content

Commit 7aafd6c

Browse files
committed
Also download rebar3 automatically when compiling
1 parent 5ff421c commit 7aafd6c

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

lib/mix/lib/mix/tasks/deps.compile.ex

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ defmodule Mix.Tasks.Deps.Compile do
227227
end)
228228
end
229229

230-
defp do_rebar3(%Mix.Dep{opts: opts} = dep, config) do
231-
if not Mix.Rebar.available?(:rebar3) do
232-
handle_rebar_not_found(dep)
230+
defp do_rebar3(%Mix.Dep{opts: opts, manager: manager} = dep, config) do
231+
if not Mix.Rebar.available?(manager) do
232+
Mix.Tasks.Local.Rebar.run(["--force"])
233233
end
234234

235235
dep_path = opts[:dest]
@@ -285,32 +285,6 @@ defmodule Mix.Tasks.Deps.Compile do
285285
|> Mix.Rebar.serialize_config()
286286
end
287287

288-
defp handle_rebar_not_found(%Mix.Dep{app: app, manager: manager}) do
289-
shell = Mix.shell()
290-
291-
shell.info(
292-
"Could not find \"#{manager}\", which is needed to build dependency #{inspect(app)}"
293-
)
294-
295-
install_question =
296-
"Shall I install #{manager}? (if running non-interactively, " <>
297-
"use \"mix local.rebar --force\")"
298-
299-
if not shell.yes?(install_question) do
300-
error_message =
301-
"Could not find \"#{manager}\" to compile " <>
302-
"dependency #{inspect(app)}, please ensure \"#{manager}\" is available"
303-
304-
Mix.raise(error_message)
305-
end
306-
307-
Mix.Tasks.Local.Rebar.run(["--force"])
308-
309-
if not Mix.Rebar.available?(manager) do
310-
Mix.raise("\"#{manager}\" installation failed")
311-
end
312-
end
313-
314288
defp do_make(dep, config) do
315289
command = make_command(dep)
316290
shell_cmd!(dep, config, command, [{"IS_DEP", "1"}])

0 commit comments

Comments
 (0)